Skip to content

Building complex SQL command

I am using sql for select, update, insert and some other features, but only simple ones until now. Now I need to write a complex command. I have looked at using case but I do not know how to implement it. This is what it should look like: I used ~TACNO~ to point out where I need a conditional value.

Getting all weeks data of a month using inner join

I have the following query: Above query explanation: I’m getting all weeks data PaidKM which driver gets in a whole month. The month for example starting date is 01-07-2018 and ending date is 31-07-2018 which covers whole month # 07. But when I change the month it gives me the same results all time. Abo…

Error in Firebird Procedure

I have to do one query to get one parameter (I need a “1”), but this parameter can be in different cells, for example: +————–+————–+————–+ |….cell1…..|…..cell2….|……

Why did I sum the wrong result?

I’d like to have an advice for this SUM that doesn’t work as expected. I have to SUM data from the same day and display it in a table. I did a query like this: This is the ‘simple’ one and it displays every single row, I have to put a SUM in it to make it show every day

Multiple joins in SQL statement

To clear things up, I have two tables, employees and jobs. In employees I have columns firstname, lastname, employees id. In jobs I have columns job_id, job_name, job_description, job_opener, …

SUM of columns duplicates

I have table as below DATE | JOB_ID |Name | Count ——————–|———–|———–|——– 01-JAN-18 01:02:41 | JOB_1 | weight | 200 01-JAN-18 01:02:41 | …