Let’s suppose that I have the following data: CustomerID->Number->Date 1->2->1/1/2019, 1->3->2/1/2019, 2->1->1/1/2019, 2->6->2/1/2019 I want to have a column let’s …
Tag: sql
Model not returning value when one field used in select
I have a question with my if statement. I want to get check what is bigger than another price value. one value is saved in my database table and another one is getting with input value. but I wrote …
How can I use rank function to solve this?
I have this data: and I want to this result: So I ve tried this: but it did not solve my problem. How can I solve this issue? thanks in advance Answer DENSE_RANK not RANK:
Oracle SQL: select count of multiple distinct fields
I need to select id, type and count of rows with unique id-type combinations. So I tried something like this: SELECT ID, CASE WHEN /**/ THEN ‘FIRST’ WHEN /**/ THEN ‘ANOTHER’ …
Average across rows in SQL Server 2008
I have the following table Data Data1 Data2 YTD ————————- 1 2 3 2 3 4 3 3 6 In the YTD column I have to average the rows data. I can …
get the values mit highets value sql
the following table is given (in Oracle); LVL KID FATHER 1 POD001 DPR001 1 POD002 DPR002 1 POD003 POD002 2 POD003 DPR002 2 POD004 DPR001 1 POD004 POD001 2 POD005 POD002 …
Redshift – CASE statement checking column EXISTS or no
I am querying dynamically tables where some of the tables might not have specific column. My intention is check the existence of the column and dynamically assign a value. Basically if all the tables …
Convert string to a date in db2
Ok I was able to get it fixed. I want to convert the string “10-Feb-2019 11:20” to “DD-mm-yyyy hh24:mi:ss”. I tried to date but it wasn’t working. I saw on other threads that the translate function …
Descending not working in query, but it should work? [closed]
I am making a scoreboard for my internship, for the games we play in the break. I have a really big query to get the results of all games and count the total of wins by players. SELECT winner, SUM(…
How can I solve this & reach better performance
We are using an ERP system, here is one sql query below – and it’s working: (it’s using an old syntax) (select last_name||’ ‘||name||’ ‘||to_char(datum_p,’DD.MM.YYYY’) from ( select co….