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)
 query problem

Author  Topic 

aks
Starting Member

28 Posts

Posted - 2005-03-15 : 13:47:11
Hi,
I have a table with following fields:
UID INT NAME
============================================
34 1111 Jan
34 1124 2004
34 67 hr
34 1117 JULY
34 1124 2004
34 56 hr
56 1111 JAN
56 1125 2005
56 3 hr
56 1119 SEPT
56 1124 2004
56 78 hr

I'm trying to get the output as JAN in 2005(1125) only not 2004(1124)
BUT JULY I want in 2004(1124) LIKE:
UID NAME
============================
34 1117
34 1124
34 56
56 1111
56 1125
56 3
56 1119
56 1124
56 78
I used the foolwing query but its giving me NO JAN value neither 2004 nor 2005.

select a.uid,b.val_int from hr a, hr b,hr c where
a.recordset_id=b.recordset_id and
a.recordset_id=c.recordset_id
AND
((a.val_int=1111and b.val_int=1125) or
(a.val_int=1112 and b.val_int=1125)or
(a.val_int=1113 and b.val_int=1125) or
a.val_int=1114 or
a.val_int=1115 or
a.val_int=1116 or
a.val_int=1117 or
a.val_int=1118 or
a.val_int=1119 or
a.val_int=1120 or
a.val_int=1121 or
a.val_int=1122
)
AND
c.question_id=1123
order by a.uid

Kristen
Test

22859 Posts

Posted - 2005-03-16 : 01:30:45
Duplicate of http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=47117
Go to Top of Page
   

- Advertisement -