I have a feature I am working on and I need my PostgreSQL db to return all the users that have not completed a survey today. I am using a left join to join on my survey results table and filtering by customer_id and where the survey_results.created < today but I am using a date part and extract to get
Tag: datetime
convert date unix to timestamp
I want to convert type date unix to timestamp in Informix. My column date1 contains values as 1598915961, 1598911249, 1598911255… expected output: 2020-02-13 15:00:00 How should I do it, please?
SQL statement to select all dead people
I have tables: City: zip, name,… People: id, city_zip(refers to city.zip), born_time, dead_time I need to select data about cities where ALL people from that city are dead: born_time NOT NULL AND …
How to loop through table using while loop and create another table with values needed
I have two tables: MainTable and MyTable. MyTable has unique ControlNo and ID. I need to add very first EffDate from MainTable to MyTablebased on ID and ControlNo. For that I need to look at …
How to capture first row in a grouping and subsequent rows that are each a minimum of 15 days apart?
Assume a given insurance will only pay for the same patient visiting the same doctor once in 15 days. If the patient comes once, twice, or twenty times within those 15 days to the doctor, the doctor …
SQL Query calculating two additional columns
I have a table which gets populated daily with database size. I need to modify the query where I can calculate daily growth and weekly growth. Current Output I would like to add two additional columns which would be Daily Growth (DB_SIZE sysdate – DB_SIZE (sysdate -1)) Weekly Growth (DB_SIZE sysdate – DB_SIZE (sysdate -7)) Need some help constructing the
what does this hyphen do between columns in order by clause in mysql query?
what does this hyphen do between updated_at and created_at columns in order by clause ? select * from `users` order by updated_at – created_at DESC
I need some help in a query in SQL Server [closed]
I need a query that filters from the first day of the previous month and the current day at 0 hours. Can anyone help me?
SQL find max date based on a non null other column
I have a table like so: And I would like to return an entire row containing the uniqueID, scandatetime, and latest scanfacilityname (i.e., max scandatetime where scanfacilityname is not null). I have tried the following query: But im not sure if this is correct/if I need the coalesce. Answer You can use the max_by function: See the doc. There’s no
Cross Join in Hive
I’m trying to create a new column time_period while running the query below. If the date difference between a given transaction and the most recent transaction in the reference table is fewer than 7 days, then mark it as a recent transaction, else mark it as an old transaction. However, the query below is generating an error in the subquery