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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 how can get only the rows with *

Author  Topic 

CLages
Posting Yak Master

116 Posts

Posted - 2006-10-23 : 19:09:10
Hi
i have this table in fact this is a result of a query with joins
but to became simple.

c1 c2 c3 c4 c5 c6 c7 c8(ddmmyyyy)
59 006 11425 1 2.000 428.17 856.34 15/01/2006
59 006 11425 1 1.000 228.17 456.34 16/01/2006 *
59 006 11427 1 6.000 35.81 214.86 16/01/2006
59 006 11427 1 7.000 45.81 314.86 17/01/2006 *
59 006 114421 1 12.00 26.50 318.00 17/01/2006 *
59 006 24561 1 12.00 26.90 322.80 17/01/2006 *

how can get only the rows with * ?
because code column c3 11425 and 11427 occurs twice , in this case i want all the rows and when occurs that one code occurs more than 1
then i want the oldest based in column c8(date)

if i use a group by i can not get what i want.

tks again

C.lages

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-10-23 : 19:29:02
Use LIKE on your column that contains *.

Tara Kizer
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-10-23 : 22:34:02
Select * from table T
where c8=(Select max(c8) from table where c3=T.c3)

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -