If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Simple Delete Query
I have a table that includes the field titled "State". I want to delete all
records in a table except records that have "AZ", "CT" or "NY" in the state field. I have tried the criteria of =Not "AZ" or"CT or "NY", but I'm not getting the correct results. I only retain AZ records. Any help you can provide is appreciated, thank you. |
#2
|
|||
|
|||
Simple Delete Query
"SITCFanTN" wrote in message
... I have a table that includes the field titled "State". I want to delete all records in a table except records that have "AZ", "CT" or "NY" in the state field. I have tried the criteria of =Not "AZ" or"CT or "NY", but I'm not getting the correct results. I only retain AZ records. Any help you can provide is appreciated, thank you. Try this: DELETE FROM [YourTableName] WHERE [State] Not In('AZ', 'CT', 'NY') -- Dirk Goldgar, MS Access MVP Access tips: www.datagnostics.com/tips.html (please reply to the newsgroup) |
#3
|
|||
|
|||
Simple Delete Query
Try:
DELETE * FROM [YourTable] WHERE State NOT IN("AZ","CT","NY"); Ken Sheridan Stafford, England SITCFanTN wrote: I have a table that includes the field titled "State". I want to delete all records in a table except records that have "AZ", "CT" or "NY" in the state field. I have tried the criteria of =Not "AZ" or"CT or "NY", but I'm not getting the correct results. I only retain AZ records. Any help you can provide is appreciated, thank you. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...ccess/201005/1 |
#4
|
|||
|
|||
Simple Delete Query
Not "AZ" or Not "CT" or Not "NY"
This is cleaner: Not In ("AZ", "CT", "NY") Jerry Whittle, Microsoft Access MVP Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder. "SITCFanTN" wrote: I have a table that includes the field titled "State". I want to delete all records in a table except records that have "AZ", "CT" or "NY" in the state field. I have tried the criteria of =Not "AZ" or"CT or "NY", but I'm not getting the correct results. I only retain AZ records. Any help you can provide is appreciated, thank you. |
#5
|
|||
|
|||
Simple Delete Query
On Fri, 7 May 2010 12:58:01 -0700, Jerry Whittle
wrote: Not "AZ" or Not "CT" or Not "NY" Sleepy, Jerry? g That should be "AND" rather than "OR" - "AZ" is in fact Not "NY", so this criterion will delete all records in the table! This is cleaner: Not In ("AZ", "CT", "NY") Absolutely better. -- John W. Vinson [MVP] |
#6
|
|||
|
|||
Simple Delete Query
Looks like I need a brain reboot. One dope-slap self-applied to the head.
Thanks John! -- Jerry Whittle, Microsoft Access MVP Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder. "John W. Vinson" wrote: On Fri, 7 May 2010 12:58:01 -0700, Jerry Whittle wrote: Not "AZ" or Not "CT" or Not "NY" Sleepy, Jerry? g That should be "AND" rather than "OR" - "AZ" is in fact Not "NY", so this criterion will delete all records in the table! This is cleaner: Not In ("AZ", "CT", "NY") Absolutely better. -- John W. Vinson [MVP] . |
Thread Tools | |
Display Modes | |
|
|