Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
What am I doing wrong that's not bringing back my where clause? I am getting other records as well but only want the ones specified below.select * FROM diaries1where (diarycode1 = '9W' or diarycode1 = '5W' or diarycode1='7W') or (diarycode2 = '9W' or diarycode2='5W'or diarycode2='7W')or (diarycode3 = '9W' or diarycode3 = '5W' or diarycode3='7W')
elancaster
A very urgent SQL Yakette
1208 Posts
Posted - 2008-07-03 : 09:23:56
can you show us some test data and illustrate which records you do / don't want to be returned?Em
JJ297
Aged Yak Warrior
940 Posts
Posted - 2008-07-03 : 09:28:45
After executing the where clause I get this data in the DiaryDTE1 field:DIARYDTE19W9W2EMRMR5WJRJR7W7WI only want 5W, 7W and 9W
elancaster
A very urgent SQL Yakette
1208 Posts
Posted - 2008-07-03 : 09:31:40
hmmm.... do you actually want....?
where diarycode1 in ('9W','5W','7W') and diarycode2 in ('9W','5W','7W')and diarycode3 in ('9W','5W','7W')
if not, show more test data with the other column combinations tooEm