Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
rdoyal
Starting Member
15 Posts |
Posted - 2010-10-22 : 17:44:46
|
| SELECT VendorName, MAX(InvoiceNumber) AS InvoiceNumber, MAX(InvoiceTotal) AS Invoicetotal, MIN(InvoiceDate) AS EarliestDateFROM Vendors JOIN Invoices ON Vendors.VendorID = Invoices.VendorIDGROUP BY VendorNameORDER BY EarliestDate DESCReturns 34 rows, which is right! But I'm not understanding how to do a subquery in the Statement? Pseudocode, I'm Totaly Lost. I would be thankful for any help!-------------------------------------------------------------------------------- |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2010-10-22 : 18:07:32
|
| What do you need to do a subquery for? You haven't provided a case for it. |
 |
|
|
rdoyal
Starting Member
15 Posts |
Posted - 2010-10-22 : 19:05:09
|
| Can you elaborate on that a little more Please? We have been working on subquerys thoughtout this Chapter and I just asummed that this one would have one also. I do know from others that is has an AND in it. and they have mentioned a page reference of 203, which is Pseudocode. |
 |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2010-10-22 : 23:29:13
|
| I have no idea what you're talking about. |
 |
|
|
rdoyal
Starting Member
15 Posts |
Posted - 2010-10-23 : 00:41:48
|
| I am trying to do a subquery for this statement that will return 34 rows with the earlier invoice date. I am Useing 2008 AP. My Group is underlinedSELECT VendorName, InvoiceNumber, InvoiceDate, InvoiceTotal FROM Vendors JOIN (SELECT MIN(InvoiceDate) AS EarliestDate FROM Invoices JOIN GROUP BY VendorName, InvoiceNumber, EarliestDate , InvoiceTotalORDER BY EarliestDate DESC) |
 |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-10-23 : 01:06:54
|
quote: Originally posted by robvolk I have no idea what you're talking about.
He is expecting that everyone here should by default know about his practice questions.PBUH |
 |
|
|
|
|
|
|
|