![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I want to return records based on a linetype and classtype Here is what I have so far Where (LineType = '1' OR LineType = '7') or (LineType = '5'AND ClassType NOT LIKE '[_]%') I am trying to return all LineType 1 and 7 and only LineType 5 where the classtype does not start with an underscore but the above syntax doesn't return any records where the ClassType starts with an underscore regardless of whether they are LineType 1, 7 or 5 How can I achieve my goal? Thanks |
#3
| |||
| |||
|
|
On Thu, 17 Mar 2005 10:09:21 -0000, Newbie wrote: Hi, I want to return records based on a linetype and classtype Here is what I have so far Where (LineType = '1' OR LineType = '7') or (LineType = '5'AND ClassType NOT LIKE '[_]%') I am trying to return all LineType 1 and 7 and only LineType 5 where the classtype does not start with an underscore but the above syntax doesn't return any records where the ClassType starts with an underscore regardless of whether they are LineType 1, 7 or 5 How can I achieve my goal? Thanks Hi Newbie, I'm sorry, but I could not reproduce the behaviour you're reporting. Run the following script in Query Analyzer and check the results: create table test(LineType char(1) not null, ClassType char(3) not null) go insert test select '1', '_as' union all select '1', 'dfg' union all select '5', '_as' union all select '5', 'dfg' union all select '7', '_as' union all select '7', 'dfg' union all select '8', '_as' union all select '8', 'dfg' go select * from test Where (LineType = '1' OR LineType = '7') or (LineType = '5'AND ClassType NOT LIKE '[_]%') go drop table test go Results on my test database: LineType ClassType -------- --------- 1 _as 1 dfg 5 dfg 7 _as 7 dfg If you have different results, then please paste the output of SELECT @@VERSION in a reply to this message. If you have the same results, then it must be something else. Please post a simple script (as I did above) that allows me to reproduce the behaviour. Include the expected output as well. (www.aspfaq.com/5006) Best, Hugo -- (Remove _NO_ and _SPAM_ to get my e-mail address) |
![]() |
| Thread Tools | |
| Display Modes | |
| |