Skip to content
Advertisement

Tag: date

Add additional column to the query output

I have the following query that is grabbing data from a table and combining all the products into one column and counting the quantity of that order. I need to add an additional column to the output though, how can I also add ship_date? This is how the original table is laid out: And this is how the query outputs

check date in create table sql

edit: version 8.0.20 I’m learning sql just now, I try to fix it but I’m not able to do it. I have 3 table This is an easier scheme but it’s enough. The return_date must be less than delivery_date + 30 days I tried to use a check on return_date but no work, so I created a view to select

MySQL Running Total By Group, Time Interval

I would like to take a table of customer orders like this: And create a table calculating a cumulative running total by week, segmenting the weeks by 7 days starting at the earliest date (2020-03-01, 2020-03-08, etc.). Something like: Thanks for the help! Answer You can use aggregation and window functions (this requires MySQL 8.0). It is easier and more

SQL Date range by month returns in multiple rows

I am looking to get the count of entries by the month. However, this is returning the total count. I would like it to be something like. Month —– Count January —- 500 February —- 600 If I can’t get the month in there, thats fine, but I would definitely like to have it so the count has its own

Advertisement