Author |
Topic |
Luijo
Starting Member
5 Posts |
Posted - 2013-03-29 : 18:59:01
|
Hi everyone, I`m new at this forums, hoping somebody can help me with this question, Thanks:Write a summary query WITH CUBE that returns LineltemSum (which is the sum of lnvoiceLineltemAmount) grouped by Account (an alias for AccountDescription) and State (an alias for VendorState). Use the CASE and GROUPING function to substitute the literal value "*AIL*" for the summary rows with null values. |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-03-30 : 01:54:02
|
look up for syntax of WITH CUBE in books online and try. post if you face any issues in it. Otherwise we wont help with assignment questions.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
Luijo
Starting Member
5 Posts |
Posted - 2013-03-30 : 10:59:49
|
Thanks a lot Visakhm, I will.quote: Originally posted by visakh16 look up for syntax of WITH CUBE in books online and try. post if you face any issues in it. Otherwise we wont help with assignment questions.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
|
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-03-31 : 02:57:05
|
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
Luijo
Starting Member
5 Posts |
Posted - 2013-03-31 : 10:20:26
|
so far this is what I got, but something is not right:SELECT SUM(InvoiceLineItemAmount) AS LineItemSum, CASEWHEN GROUPING(VendorState) = 1 THEN '*ALL*'ELSE VendorState END StateFROM Vendors, InvoiceLineItems, GLAccounts, InvoicesWHERE Vendors.VendorID = Invoices.VendorIDAND Invoices.InvoiceID = InvoiceLineItems.InvoiceIDAND GLAccounts.AccountNo = InvoiceLineItems.AccountNoGROUP BY AccountDescription, VendorState WITH CUBE |
|
|
Luijo
Starting Member
5 Posts |
Posted - 2013-03-31 : 10:25:08
|
also I need some help in this one too:I need to figuer it out which one is correct, if I want to return invoices due before the last day of the current month?WHERE InvoiceDueDate <= dateadd(month, datediff(month, 0, getdate()) + 1, -1)WHERE InvoiceDueDate < dateadd(month, datediff(month, 0, getdate()) + 1, 0) |
|
|
bandi
Master Smack Fu Yak Hacker
2242 Posts |
Posted - 2013-04-01 : 00:15:08
|
second is the correct approach..... WHERE InvoiceDueDate < dateadd(month, datediff(month, 0, getdate()) + 1, 0) |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
Luijo
Starting Member
5 Posts |
Posted - 2013-04-01 : 11:09:06
|
Hi Visakh16, I really appreciated your help, I`m glad that there are still people willing to help others. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-04-01 : 11:43:01
|
welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|