All Questions
5,937
questions
0
votes
1
answer
56
views
Query between two dates gives incorrect results in SQL Server? [closed]
Im trying:
SELECT *
FROM database a
WHERE Applicant_End_date >= '2024-01-01'
AND Applicant_Start_date <= '2024-06-30';
Results:
Applicant_End_date shows results starting at 2024-01-01 like:
...
0
votes
0
answers
13
views
Can't seem to get the date parameter to work
The following query works when I don’t add the last AND statement with the dates. However, when I add it, no results are found. I know this isn’t true because I populate data into the engine and know ...
0
votes
1
answer
36
views
Return entries within last 24 hours of a specific date time in SQL
I have a dataset which contains two different datetimes - datetime1 and datetime2.
I would like to return all the entries where the datetime2 has occurred in the last 24 hours of datetime1.
I tried ...
0
votes
1
answer
22
views
Calculate day difference between one date and multiple dates in the same column
I have an input table like this
date
amount
2011-01-02
50
2011-01-03
40
2011-01-04
20
2011-01-05
10
Am looking to group it and create a one-to-many where the difference of date A1 is compared to ...
-1
votes
0
answers
40
views
How to return only the first date of the patient's measurement? [duplicate]
I have a patient list and I have the date and time when a specific procedure was done. I need to return the patients and only their first datetime when the procedure was performed during the same ...
0
votes
1
answer
56
views
How do I update timestamp values in a BigQuery table?
I need to update some date values that were stored incorrectly. I have two tables of data that I am combining. Basically, table1 and table2 contain consecutive months of the same data. Table1 has the ...
0
votes
1
answer
37
views
Is there any function extracting DD/MM/YY HH:MM:SS in BigQuery to hh:mm:ss?
In the bigquery-public-data.new_york_taxi_trips.tlc_yellow_trips_2022, the dropoff_datetime and pickup_datetime are in DD/MM/YY HH:MM:SS format, and I want to find pickup_location_id and subquery....
0
votes
1
answer
41
views
How do I convert 2022-03-01 00:00:00.000 to yyyymmdd in SQL using Case when?
I am a beginner and I use SQL Server and need help with converting date and time. How do I convert 2022-03-01 00:00:00.000 to yyyymmdd format using CASE WHEN?
I tried this:
FORMAT(pol_eff_dt, '...
0
votes
2
answers
44
views
Clickhouse logic on Nth array item IF array is long enough
I would like to convert an array of string dates into two separate datetime columns.
The array will always have at least one string date, and sometimes it will have two strings dates. It will not have ...
-1
votes
1
answer
152
views
How to "fix" incorrect datetimes and timezones in Postgres SQL Database?
I believe I have made an error when inserting some data into a SQL table.
The column containing the error has a datetime timezone aware type, which for Postgres is timestamptz.
Here is an example data:...
0
votes
1
answer
86
views
How to order date and time in BigQuery
I'm working with a dataset that runs from July 1, 2021 to May 31, 2022. I converted the original Excel spreadsheet into a CSV file, but when I run queries and try to ORDER BY date my output starts on ...
2
votes
1
answer
59
views
Mysterious date conversion
I received a SQL backup and am trying to convert some dates to a MM-DD-YYYY date format. The problem is for the life of me I can't figure out what the original date format is.
The date format is 5 ...
-1
votes
2
answers
81
views
Date comparison to find missing dates
I am trying to compare dates to find when someone is no longer eligible. In this sample they are not eligible from 10/1/23 to 10/19/23. So the 9/30/23 exp_date to the 10/20/23 eff_date. How do I find ...
0
votes
0
answers
53
views
How to change an field in SQL in a specified amount of time?
For context: My table is organized like this:
id
start
end
status
The current time can be entered (is is the default value), or the time the user prefers. The end time is set to always be two hours ...
1
vote
1
answer
194
views
Databricks SQL query very slow when comparing datetime
In Databricks SQL, I have a query that takes forever to execute, which in our old system wouldn't take more then 2 hours (4 minutes even for this piece of the query). I have traced the problem to the ...