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
 Transact-SQL (2000)
 selecting data problem

Author  Topic 

a_shipra
Starting Member

20 Posts

Posted - 2004-08-29 : 22:12:32
hi all,

i have 2 tables like

class id(Pk) class name

Aa abc
ab sss
ac awq
ad skiw
ae wqwq



item id(PK) class id

aa aa
ab aa
ss ab
qw ac
aq ad
sa ae

now my requirement is to pull the data for classes like from aa - ab and ad - ae


is this possible in any way?

mk_garg20
Constraint Violating Yak Guru

343 Posts

Posted - 2004-08-29 : 22:15:38
Basically you don't want class ac.
Is that corerct?
What you want to do?


mk_garg
Go to Top of Page

a_shipra
Starting Member

20 Posts

Posted - 2004-08-29 : 22:33:14
no this is just an example.

basically i want to skip some classes.

suppose it like

aa-ac
ba-ca
kt-kz

like that no exact sequence.

Go to Top of Page

mk_garg20
Constraint Violating Yak Guru

343 Posts

Posted - 2004-08-30 : 18:40:06
Post your table structure with data & expected results.

mk_garg
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-08-31 : 15:16:01
well since you want to pull data from classes:


select t2.*
from item t1
inner join class t2 on (t1.classid = t2.classid)
where t1.classId not in ('ab', 'bc', 'cd', 'fr')


Go with the flow & have fun! Else fight the flow :)
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2004-08-31 : 16:11:45
[code]
SELECT *
FROM ...
WHERE classID between 'aa' and 'ab' OR
classID between 'ad' and 'ae'
[/code]

???

- Jeff
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-08-31 : 16:20:23
a lot to work with... :)))

Go with the flow & have fun! Else fight the flow :)
Go to Top of Page

mk_garg20
Constraint Violating Yak Guru

343 Posts

Posted - 2004-08-31 : 18:22:04
Thanks Dr.

I never used between for strings.

mk_garg
Go to Top of Page

a_shipra
Starting Member

20 Posts

Posted - 2004-08-31 : 21:31:39
Thanks alot for your help.
Go to Top of Page
   

- Advertisement -