I have a table that I’m trying to return summarized results from for a chart that will have two datasets, one for debit transactions that have happened each month and one for payments that have happened each month. The table I’m querying looks like this: What I’m looking to get back out of my query is a result that does
Tag: datetime
Parse out Y-M-D from Y-M-D H-M-S UTC sql bigquery
I need to parse out ‘%Y%m%d’ from the column in BigQuery. My data looks like this: I have tried the following: The error message: No matching signature for function PARSE_DATE for argument types: STRING, TIMESTAMP. Supported signature: PARSE_DATE(STRING, STRING) Desired output: 2000-09-25 Answer Why not just convert to a date? Note: This works for both datetime and timestamp values. These
Partitioning rows into groups by accumulative time interval
I got a search sessions log that looks like this: My task is to partition each row into session groups. Session groups are up to five minutes. For example: Those TOP 3 sessions will form a group session 1 – if we accumulate the minutes between each row, we will get 3 minutes and the 4th would accumulate to more
Count how many times a rows enter time is within the enter and exit times of all other rows
I am looking to estimate a queue length for historical data at the time a record enters the queue. I would like to do this by counting how many of the rows in the data set have an enter time less than the enter time of the record, and an exit time greater than the enter time of the record.
Date conversion in SQL from 10-09-2020 to 2020-09-10
I want to convert it for comparing data & here I am stuck. I have data in date column like 10-09-2020 where convert(varchar, date, 111) >= ‘2020-09-10’ AND convert(varchar, date, 111) <= '...
Mysql subtract and sum
I have a below table in mysql. DROP TABLE IF EXISTS `mdc_data`; CREATE TABLE `mdc_data` ( `id` int(11) NOT NULL AUTO_INCREMENT, `tariff_id` int(11) DEFAULT NULL, `msn` varchar(100) DEFAULT NULL, `…
Oracle SQL: how to show only one max per group
Hi everyone first thanks for your time. I have this data Data: And I have to obtain the max values of everygroup, if there is one group that has two same max values like A 40 23/56/1982 A 40 31/4/…
compute time difference between rows and conditional group by using PostgreSQL
I have data like as shown below: +——-+——-+ | index | time | +——-+——-+ | 1 | 09.00 | | 2 | 09.02 | | 3 | 09.03 | | 4 | 09.05 | | 5 | 09.11 | | 6 | 09.12 | | …
how to check a date is in current financial year
I am trying to check a condition if given date is in current financial year i.e april to march. but not getting any idea how to do code select nvl(Count(1), 0)+1 from ASET where IPE=’O’ and irt in (…
How do I get the matching id for every record?
My table is called platform_statuses, here is its schema: And this is my query, I would like to also get the matching id for the returned records. Also note that the abs function you see in the query is a custom one I got off this answer. Here is its definition: Answer I understand that, for each account and day,