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

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-05-17 : 09:47:11
kishore writes "in my data base category and news tow table is there
when i am putting the news in table using the front ends then my news category can have multiple i mean one news can go multiple category so i am storing the catefory on the comma based like 2,3,4,5,6 so on

so when i am making the search on the front ends
i have writtn the query select * from news where cat_id
like '%2%' so its also giving me all the record like 12,24 ,32
but i need only cat_id 2

so what would be the query for that to search only id 2
i used in cat ID in ('2') but its not right becus its only searc single records not comma based .although i have to use split but can u have a query for that without use of split

waiting for ur reply
ASP
SQl
for developing tool"

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-05-17 : 09:57:30
U have to normalize ur data.
A workaround for ur question is using '%,2,%' instead of '%2%'

Srinika
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-18 : 03:05:39
Read about Normalisation
http://www.datamodel.org/NormalizationRules.html

Madhivanan

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

- Advertisement -