Friday, March 30, 2012

query question

I have a table where one of the fields is named SHIPPER
in the field, it will have the names of various shippers. ShipperA,
ShipperB ShipperC and ShipperD as an example
I need to make a query where it will return all the records where the
SHIPPER is ShipperA, ShipperB, ShipperD
All help would be great!
ThanksSELECT *
FROM YourTable
WHERE Shipper IN ('ShipperA', 'ShipperB', ShipperD')
?
If this doesn't work, please post DDL and sample data (
http://www.aspfaq.com/etiquette.asp?id=5006 )
"johnfli" <john@.here.com> wrote in message
news:OTiQIf8rEHA.3588@.tk2msftngp13.phx.gbl...
> I have a table where one of the fields is named SHIPPER
> in the field, it will have the names of various shippers. ShipperA,
> ShipperB ShipperC and ShipperD as an example
> I need to make a query where it will return all the records where the
> SHIPPER is ShipperA, ShipperB, ShipperD
> All help would be great!
> Thanks
>|||Thank you for the quick reply.
I wasn't able to get it to work, I am sure it has something to do with the
wildcards.
I modified your line to read:
WHERE Shipper IN ('%ShipperA%', '%ShipperB%', '%ShipperD%')
as for some reason, the names were inputted with partial address
thanks again if you're able to fix this.
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:%23i6goi8rEHA.3848@.TK2MSFTNGP14.phx.gbl...
> SELECT *
> FROM YourTable
> WHERE Shipper IN ('ShipperA', 'ShipperB', ShipperD')
> ?
> If this doesn't work, please post DDL and sample data (
> http://www.aspfaq.com/etiquette.asp?id=5006 )
>
> "johnfli" <john@.here.com> wrote in message
> news:OTiQIf8rEHA.3588@.tk2msftngp13.phx.gbl...
>|||Sorry, IN does not support wild cards. You'll have to use LIKE with OR:
WHERE Shipper LIKE '%ShipperA%'
OR Shipper LIKE '%ShipperB%'
OR Shipper LIKE '%ShipperD%'
"johnfli" <john@.here.com> wrote in message
news:uz2VMo8rEHA.1644@.tk2msftngp13.phx.gbl...
> Thank you for the quick reply.
> I wasn't able to get it to work, I am sure it has something to do with the
> wildcards.
> I modified your line to read:
> WHERE Shipper IN ('%ShipperA%', '%ShipperB%', '%ShipperD%')
> as for some reason, the names were inputted with partial address
> thanks again if you're able to fix this.
>|||perfect!
thank you
"Adam Machanic" <amachanic@.hotmail._removetoemail_.com> wrote in message
news:OWbQUr8rEHA.556@.tk2msftngp13.phx.gbl...
> Sorry, IN does not support wild cards. You'll have to use LIKE with OR:
> WHERE Shipper LIKE '%ShipperA%'
> OR Shipper LIKE '%ShipperB%'
> OR Shipper LIKE '%ShipperD%'
>
> "johnfli" <john@.here.com> wrote in message
> news:uz2VMo8rEHA.1644@.tk2msftngp13.phx.gbl...
the[vbcol=seagreen]
>

No comments:

Post a Comment