Skip to content

sql query to display those with 0

I have to show drivers and nr of trips in January 2019. I also need to show those with 0 trips in January 2019. Below is the query, but it doesnt show me those with 0 trips in january 2019. select …

Mysql INNER JOIN after a LEFT OUTER JOIN

I have below query; SELECT * FROM product pr LEFT OUTER JOIN product_field_value pfv ON pfv.product_id = pr.id AND pfv.product_field_id = 64 INNER JOIN product_colour pc ON pc.id = pfv.value Now, …

SQL to Get Latest Field Value

I’m trying to write an SQL query (SQL Server) that returns the latest value of a field from a history table. The table structure is basically as below: ISSUE TABLE: CHANGEGROUP TABLE: CHANGEITEM TABLE: EXPECTED RESULT: So each change to an issue item creates 1 change group record with the date the chang…

Split and compare two Strings in Oracle SQL

I have a table with three columns structured as followed: Now I would like to perform an Oracle-SQL-query which gives me the edit-pattern of the two strings left and right. The result should be as followed: Al my tries with REGEX_SPLIT and CONNECT BY were not successful. Do you have any ideas how to solve tha…

SQL Request with LEFT JOIN not able to find data

I’m working on my C# project and I have to get data from database thanks to .sql procedures. Synthesis : Table ProprietesCourantes is linked to table Entite. Table Archive is linked to table …

Oracle Select max where a certain key is matched

i’m working with oracle, plSql, i need to query a table and select the max id where a key is matched, now i have this query It’s displaying this data If i remove the ID from the query, it displays the distinct keys (in the query i use the alias KIES because keys was in blue, so i thought it