I have a table to store events like this: and another table to store posts like this: if I want to get count of posts that happened during a single event I can write: but how can I get the count of posts that happened during multiple events, when the target events are only known at runtime? Edit: the database
Tag: datetime
Query: generated start_date and end_date where it isn’t exist in the table
i want to ask something, so i have a table A that have start_date and end_date column to store the data when there is a failure happened, it look like this rows start_date end_date 1 “2021-08-01 00:04:00” “2021-08-01 02:54:00” 2 “2021-08-01 04:52:00” “2021-08-01 05:32:00” And what i want to do is to have a query so that the response will
Snowflake error when using datetime variable in a query
I am trying to query a database table for a specific date range. When the dates are hardcoded, the query works without any problem, however, when I try to use the variables, Snowflake is returning an error message “”, there is no additional information. I have tried using Date, DateTime, DateTimeLTZ, Varchar datatypes but so far nothing has worked. Snowflake
ORACLE CONVERT CHAR FORMAT “YYYY-WW” TO DATE FORMAT
I am trying to convert char date format “YYYY-WW” in ORACLE to date for calculating by week in year but have a trouble with error message format code cannot appear in date input format If i write It will be normal But if i write The message error format code cannot appear in date input format appear. I don’t have
ValueError when reading dates from hfsql database using ODBC
With some struggles I connected to a hfsql server using ODBC. I’ve tried both pypyodbc and pyodbc. My goal is to get some insights in the data (and visualize some aspects). For some planning visualization I need to read out some of the data, which works fine for most tables and columns. However, when I try to read out a
Output number of non-consecutive failures from historical data in Bigquery
this is related to my previous scenario. I have a dataset like this: Aside from outputting the timestamp in which a user first committed a failure, and consecutively commits a failure status every day, leading up to today (2022-04-29), I also want to output the non-consecutive block of days in which Karl or Andrea commits a failure. In this case,
Convert string date format MM/dd/yyyy HH:mm:ss.SSSS to timestamp presto
I have a string that looks like: I am trying to convert this to a timestamp as follows: but i keep getting an error: Answer The value in your example matches the format of timestamp literals in SQL, so you can convert it to a timestamp type by just casting the value to the desired type:
Oracle using MOD command to set Y/N on INSERT
I’m trying to generate some sample data for the following table see below. I have functions that can generate a random DATE and timestamp within a date range, which is working fine. I want to use the MOD command to populate the active field to ‘Y’ OR ‘N’. I want to set every row to active=’Y’ except for every 5th
SQL Server – Counting total number of days user had active contracts
I want to count the number of days while user had active contract based on table with start and end dates for each service contract. I want to count the time of any activity, no matter if the customer had 1 or 5 contracts active at same time. In result I want a table: Where 1477 stands by 1053 (days
How can I make TO_DATE in Amazon Redshift work with multiple date formats in the same column?
I have a string column with date-time values that I need to convert into dates in order to calculate a dense rank. This column can have any of the below 3 formats: My SQL Statement to calculate the dense rank is based on this date-time column that I need to convert to date in order to rank descending: However, I’m