|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
WHERE clause 'SET'Is there an easier way to write the WHERE clause when the same column is
compared over and over again? I need to pull by 360 zip codes. Instead of Where Zipcode = '12345' OR Zipcode = '54321' OR......and so on. Something like Where Zipcode = OR{12345,54321,12342...}would be what i'm looking for. Thanks Amon Borland skrev:
> Is there an easier way to write the WHERE clause when the same column is That would be 'IN', like "WHERE zipcode IN ('12345', '54321', ...)".> compared over and over again? I need to pull by 360 zip codes. Instead of > Where Zipcode = '12345' OR Zipcode = '54321' OR......and so on. > > Something like Where Zipcode = OR{12345,54321,12342...}would be what i'm > looking for. > > Thanks Be sure using the correct data type, though, 12345 or '12345'... /impslayer, aka Birger Johansson To add to impslayer's response.
Are you saying that you have 360 zipcodes in your WHERE clause? Exactly what are you doing? One solution, that may or may not apply to your problem, is to insert the zipcodes into a temp table and join on that table. Can you give us a bit more information? Show quote "Amon Borland" <AmonBorland@+nospam+gmail.com> wrote in message news:ubuTIY09FHA.1332@tk2msftngp13.phx.gbl... > Is there an easier way to write the WHERE clause when the same column is > compared over and over again? I need to pull by 360 zip codes. Instead > of Where Zipcode = '12345' OR Zipcode = '54321' OR......and so on. > > Something like Where Zipcode = OR{12345,54321,12342...}would be what i'm > looking for. > > Thanks > > > Yes thats what I'm saying. I have to pull all clients that have a zipcode
matching one of the 360. I was asking what the shorthand way of doing this was, like as a set of data. WHERE IN seems like it will work although I'm having data conversion issues. Show quote "Raymond D'Anjou" <rdanjou@canatradeNOSPAM.com> wrote in message news:eu7NFj09FHA.3608@TK2MSFTNGP09.phx.gbl... > To add to impslayer's response. > Are you saying that you have 360 zipcodes in your WHERE clause? > Exactly what are you doing? > One solution, that may or may not apply to your problem, is to insert the > zipcodes into a temp table and join on that table. > Can you give us a bit more information? > > "Amon Borland" <AmonBorland@+nospam+gmail.com> wrote in message > news:ubuTIY09FHA.1332@tk2msftngp13.phx.gbl... >> Is there an easier way to write the WHERE clause when the same column is >> compared over and over again? I need to pull by 360 zip codes. Instead >> of Where Zipcode = '12345' OR Zipcode = '54321' OR......and so on. >> >> Something like Where Zipcode = OR{12345,54321,12342...}would be what i'm >> looking for. >> >> Thanks >> >> >> > > Are the zipcodes you're comparing to always the same ones?
Concerning your data conversion issues, is the zipcode column defined as a string or number datatype? Show quote "Amon Borland" <AmonBorland@+nospam+gmail.com> wrote in message news:eKQrew09FHA.912@TK2MSFTNGP11.phx.gbl... > Yes thats what I'm saying. I have to pull all clients that have a zipcode > matching one of the 360. I was asking what the shorthand way of doing > this was, like as a set of data. WHERE IN seems like it will work > although I'm having data conversion issues. > > "Raymond D'Anjou" <rdanjou@canatradeNOSPAM.com> wrote in message > news:eu7NFj09FHA.3608@TK2MSFTNGP09.phx.gbl... >> To add to impslayer's response. >> Are you saying that you have 360 zipcodes in your WHERE clause? >> Exactly what are you doing? >> One solution, that may or may not apply to your problem, is to insert the >> zipcodes into a temp table and join on that table. >> Can you give us a bit more information? >> >> "Amon Borland" <AmonBorland@+nospam+gmail.com> wrote in message >> news:ubuTIY09FHA.1332@tk2msftngp13.phx.gbl... >>> Is there an easier way to write the WHERE clause when the same column is >>> compared over and over again? I need to pull by 360 zip codes. Instead >>> of Where Zipcode = '12345' OR Zipcode = '54321' OR......and so on. >>> >>> Something like Where Zipcode = OR{12345,54321,12342...}would be what i'm >>> looking for. >>> >>> Thanks >>> >>> >>> >> >> > > |
|||||||||||||||||||||||