Page 1 of 1

Here is the SQL question: HOW MANY TOTAL SALES ARE COMPLETED EACH MONTH? If I replace 1 with salesdt, then the output wi

Posted: Mon Jul 11, 2022 9:49 am
by answerhappygod
Here is the SQL question: HOW MANY TOTAL SALES ARECOMPLETED EACH MONTH?
Here Is The Sql Question How Many Total Sales Are Completed Each Month If I Replace 1 With Salesdt Then The Output Wi 1
Here Is The Sql Question How Many Total Sales Are Completed Each Month If I Replace 1 With Salesdt Then The Output Wi 1 (63.99 KiB) Viewed 24 times
Here Is The Sql Question How Many Total Sales Are Completed Each Month If I Replace 1 With Salesdt Then The Output Wi 2
Here Is The Sql Question How Many Total Sales Are Completed Each Month If I Replace 1 With Salesdt Then The Output Wi 2 (11.86 KiB) Viewed 24 times
If I replace 1 with salesdt, then the outputwill change:
Here Is The Sql Question How Many Total Sales Are Completed Each Month If I Replace 1 With Salesdt Then The Output Wi 3
Here Is The Sql Question How Many Total Sales Are Completed Each Month If I Replace 1 With Salesdt Then The Output Wi 3 (10.7 KiB) Viewed 24 times
Sales will be counted separately and won't aggregate bymonth? Can someone explain here, since date_trunc onlycaptures month?It shouldn't have any effect on source column salesdt, nor does itaffect the aggregation of the output? I will upvote you if youcan answer in detail, not just in a few sentences. Thanks.
salesdt descr cost prc The date that the particular sales occurred A description of the item sold. The cost of the item (in cents). The price of the item (in cents).
date_trunc('month', salesdt), sum (prc) from sp.mast group by 1 order by 1 line 10, column 1, location 18 date_trunc 1 2013-01-01 00:00:00+00 2 2013-02-01 00:00:00+00 3 2013-03-01 00:00:00+00 4 2013-04-01 00:00:00+00 sum 9583179 12830204 17783417 20399001
Select date_trunc('month', salesdt), sum (prc) from sp.mast group by salesdt order by salesdt G line 19, column 1, location 36 date_trunc 1 2013-01-01 00:00:00+00 2 2013-01-01 00:00:00+00 3 2013-01-01 00:00:00+00 sum 215955 108301 91318