Home > database >  MSSQL 2008 aggregate queries
MSSQL 2008 aggregate queries

Time:11-24





Results: JH largest date table, and the small number of delivery after this date meter


CodePudding user response:

The select TB. Code, TB. The date of purchase,
(select isnull (sum (quantity), 0) from ch where ch. Code=TB. The code and ch. The shipping date & gt;=TB. The date of purchase) as the number of
The from (
The select code, Max (purchase date) as purchase date
The from jh
Group by code
) TB

CodePudding user response:

  • Related