Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2014
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. SELECT orderdtl.partnum, orderdtl.docunitprice, orderhed.orderdate
  2. FROM mfgsys80.dbo.orderdtl AS orderdtl, mfgsys80.dbo.orderhed AS orderhed
  3. INNER JOIN(
  4. SELECT orderdtl.partnum, MAX(orderhed.orderdate) AS 'maxDate'
  5. FROM mfgsys80.dbo.orderdtl AS orderdtl, mfgsys80.dbo.orderhed AS orderhed
  6. GROUP BY orderdtl.partnum
  7. ) AS Temp
  8. ON orderdtl.partnum = Temp.partnum AND orderhed.orderdate = Temp.maxDate
  9. WHERE orderdtl.ordernum = orderhed.ordernum AND ((orderdtl.custnum=74))
  10. ORDER BY orderdtl.partnum
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement