Skip to content

ORACLE DATETIME ROUND UP WHEN MINUTES 0

I have a datetime: I need to round up just when the minutes are different to 00. Example: 1/1/2000 2:37:00 AM => should be => 1/1/2000 3:00:00 AM. (dont round up if hour =00) 1/1/2000 2:00:00 AM => should be => 1/1/2000 2:00:00 AM For now my code has round function but this one look the nearest ho…

Subquery to get derived value

I have the below table T in MySQL, with columns A and B. I want to query this table to get a value ‘C’, that has the count of the number of times the value in Column ‘A’ appears in Column ‘B’. For example, 1 appears 2 times in Column B, so the first row of column C should b…

SQL 30 day active user query

I have a table of users and how many events they fired on a given date: DATE USERID EVENTS 2021-08-27 1 5 2021-07-25 1 7 2021-07-23 2 3 2021-07-20 3 9 2021-06-22 1 9 2021-05-05 1 4 2021-05-05 2 2 2021-05-05 3 6 2021-05-05 4 8 2021-05-05 5 1 I want to create a table showing number of active users