dbTalk Databases Forums  

WHERE statement question

comp.database.ms-sqlserver comp.database.ms-sqlserver


Discuss WHERE statement question in the comp.database.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Doug
 
Posts: n/a

Default WHERE statement question - 05-21-2006 , 10:02 PM






I've inherited a db that has a table of salespeople with a field called
Territory. Territory contains a list of states that each salesperson
covers.
What I need to do is return a salespersons ID depending on if a state is in
his/her territory, something like...

SELECT SalesID
FROM Salesmen
WHERE Territory CONTAINS 'TX' (or any other state)

Territory in the db is just a list like 'TX, CA, LA'

I know there must be an easy way of doing this, but.... any suggestions.

Eventually, I'll redesign the db and split out territory as a separate
table, but can't do that now.

Thanks,
--
Doug



Reply With Quote
  #2  
Old   
scott.x.lu (Offline)
Junior Member
 
Posts: 5
Join Date: Jun 2006

Default 06-01-2006 , 11:02 PM






use group by

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.