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 …
Counting all values, a sum between one range and a count in another
Trying to run a query that does three things. I want it to: Get the amount each user earned in the month they completed their job (DateCompleted) Count all of the jobs in a database if they were …
DB link in postgres looking at another localhost image : relation tablename does not exist
i’m using docker to host two different postgresql instances to try and produce a proof of concept for python as an etl to move data between the two i can connect to the one via python fine but then when calling a procedure inside the first instance it cant find the table in the second instance im connec…
Cursor based pagination for table without a unique and sequential id column?
I’m investigating using cursor-based pagination. I have the following (postgres) table: and had begun to sketch out the pagination query (not tested): I’ve been reading these posts: https://slack.engineering/evolving-api-pagination-at-slack-1c1f644f8e12 https://engineering.mixmax.com/blog/api-pagi…
How can I turn this query that uses a join statement into a query that uses a subquery?
I’m given the query and told to rewrite it using a subquery. I tried writing but I get an error saying the column isn’t recognized? Answer You are trying to access sub-query (or inner query) table’s column outside and hence the error. Please try this:
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