I am attempting to do something like this: SELECT t.id, t.startdate, t.enddate, FOO FROM table Where “Foo” is some sql mumbo-jumbo to calculate the business days between startdate and …
Tag: datetime
Find the max date to last one year transaction for each group
I have to query in sql server where I have to find for each id it’s volume such that we have last 1 year date for each id with it’s volume. for example below is my data , for each id I need to query the last 1 year transaction from when we have the entry for that id as
How to convert MM/YYYY/DD format string to DATE in SQL Server?
I have a column for which I need to convert the data to DATE format. I receive below error whenever I encounter the data ‘MM/YYYY/DD’ format, but it works fine for other formats. Conversion failed when converting date and/or time from character string Sample data: SELECT ISDATE(’05/2020/29&#…
How can I find datas smaller than “this sunday” in mysql
I have a mysql table and a date colomb that show when I add datas… I wanna select datas smallar than this sunday from table.. HOw can I do that_? here is my code… I couldnt figure it out “sevk_tarihi < DAY(3)”… Answer I am sorry, I misunderstood the question This gives you pas…
Convert 15min to 10min timeseries in SQL Server
I have a timeseries in a 15min format with four different variables. I need to convert this into 10min timeseries format. Due to some constraints, I need to do this in SQL which I agree is probably …
Getting NULL after combining strings between date functions
Given a date column with a value 2020-05-01, I want to return 2020-Q2. The QUARTER() function is not available due to the Hive version we are using. I can get the quarter number with: (INT((MONTH(yyyy_mm_dd)-1)/3)+1). When I try to combine this with the YEAR() function and strings, I get null: How can I prope…
Is there a way to dynamically execute queries in SQL without using user defined function?
I am currently working on the table containing some documents data, focusing on the columns containing date of document and net income. What I have to do is to write an sql statement which will result …
Limit MYSQL search results to dates greater than variable
I have a MYSQL table posts which contains a VARCHAR(25) column created that is filled with datetimes in the format XXXX-XX XX:XX:XX. I’m attempting to search by dates > now – 24 hours. When searching with just one posts.uuid I get the desired result, which lists all posts from that uuid that ar…
How to find whether the same customers who ordered this month also ordered the next month?
I have an orders table Now I want to find how many of the users ordered in 1st month also ordered in the next month. In this case, user_id’s 32,24,27 ordered in 7th month but only 24 and 32 ordered in the next month. I want the result to be like : I’m lost here. Can someone please help me
MySQL: How to sum on joined queries (subqueries) with multiple conditions?
I have two tables: Table Y: indicates over what time period money is valid +———–+———+——+ | starttime | endtime | name | +———–+———+——+ | 1 | 2 | Mark | | …