Skip to content
Advertisement

Tag: date

mysql compare specific date

I have a table which contains a varchar field containing date like ’15 May 2015 – 03:10 am’ I have to compare all date in this table with the current date to retrieve row which are next the current …

How to fill missing dates and values in partitioned data?

How to fill missing dates and values in partitioned data? I’m having a lot of trouble Googling this as most of the posts seem to feature Oracle databases, and I’m working with Microsoft SQL Server. I have the following hypothetical table: I want to fill in the dates in between the gaps and copy over the value from the most

Postgresql query between date ranges

I am trying to query my postgresql db to return results where a date is in certain month and year. In other words I would like all the values for a month-year. The only way i’ve been able to do it so far is like this: Problem with this is that I have to calculate the first date and last

Return All Months & Years Between Date Range – SQL

I’m a bit stumped how I might go about this. I have a very basic query, that currently returns sales for each product, by year and month. It is grouping by year/month, and summing up the quantity. This returns one row for each product/year/month combo where there was a sale. If there was no sale for a month, then there

SQL Query Comparing Date

I have a table of items with a ‘date_added’ column. What I want to do is select all the items added during the last two weeks. How can I do that? Answer If you are using MS SQL Server try this code: For MySQL try:

Query to check if date is between two month-day values

I want to know if a date (Year-Month-Day) is between a day of the month (Month-Day). For example, I want to know if ‘April 2, 2013’ is between ‘April 2’ and ‘April 19’. I can easily do this of the range has a year value. Howver, without a year, I need ideas how to do this. Some examples of what

SQL “between” not inclusive

I have a query like this: But this gives no results even though there is data on the 1st. created_at looks like 2013-05-01 22:25:19, I suspect it has to do with the time? How could this be resolved? It works just fine if I do larger date ranges, but it should (inclusive) work with a single date too. Answer It

Advertisement