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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Select Statement

Author  Topic 

Vack
Aged Yak Warrior

530 Posts

Posted - 2012-03-14 : 15:06:02
I want a select statment that will grab the old_qty that has the oldest(min) date.

When I do my select statement I would like it to grab 34 for the old qty.

Table name: iminvtrx

select (case when min(trx_dt) then old_qty end)
from iminvtrx ??????


Trx_dt old_qty
01/01/2004 34
02/02/2005 23

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-03-14 : 15:25:43
[code]SELECT TOP (1)
Trx_dt,old_qty
FROM
iminvtrx
ORDER BY
Trx_dt[/code]
Go to Top of Page
   

- Advertisement -