|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
SQL statement help
I have a SQL statement created but it's not correct.
What I want is to get all the records: from the "tblmailinglist" table where "subscribed" is not equal to the value 'N' but might the "origin" can be equal to "ART", "ASDF", "HUU" etc. My pseudocode is: get records from tblmailinglist where subscribed is "N" and the origin has a value of "ART" or "ASDF" or "HUU" It's the "and" and the "or" together that I'm getting messed up on. The subscribed HAS to equal "N" but the origin can be a variety of differen things. What I have right now: SELECT tblmailinglist.* FROM tblmailinglist WHERE subscribed <> 'N' OR origin LIKE '%ASDF%' OR origin LIKE '%ART%' OR origin LIKE '%HUU%' OR origin LIKE '%YYU%';
__________________
If you found a post of mine helpful, please click on the on my post to add to my reputation.
|
|
#2
|
||||
|
||||
|
I think I figured it out. I replaced the first "OR" with an "AND"
|
|
#3
|
||||
|
||||
|
It should be something like this
Code:
SELECT * FROM tblMailingList WHERE Subscribed <> 'N' AND (Origin = 'Art' OR Origin = 'ASDF' OR Origin = 'HUU') |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > SQL statement help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|