Skip to content
Advertisement

Tag: sql

Postgresql Get Maximum value per day with corresponding time

I have the following table: I want to get maximum value along with Date,ReceivedTime. Expected Result: Answer This answer assumes that, in the event of two or more records being tied on a given day for the same highest value, you want to retain the single record with the most recent ReceivedTime. We can use DISTINCT ON here:

BigQuery – SQL UPDATE and JOIN

I have two tables. Table1 = dalio which is an event list with select customers. Table2 = master_list which is a master customer list from all past events. dalio has an “id” column that needs to be filled in with customer numbers, which can be pulled from master_list column called “customer_no”. All rows in the “id” column are currently blank.

Assistance with PERCENTILE_CONT function and GROUP By error

All, I am having problems with the below query. I am trying to get stat data from our database for the last 3 years but I keep getting the error message: ***Column ‘OC_VDATA.DATA1’ is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.*** I know it has something to

Python Script to run SQL query UPDATE statement to loop through each row in result set and update columns

Newby working on my first project. Sorry for this explanation. I have 2 x tables: t1: master table with single rows (unique project-id) and 3 status fields, s1,s2,s3 t2: list table with repeating project_id’s with 3 status fields s1,s2,s3 (and other data not relevant here). The value in the s1-3 fields is either true(1) or false(0) table1: project_id, status1, status2,

Advertisement