Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Like Operator in MS Access 97 1

Status
Not open for further replies.

hianjali

Programmer
Jan 5, 2006
29
US
Hello All,

I need to pull the records where the location starts with 'z' or 'y'. Here is my query

SELECT elgemp.ENR_GRP_NUMBER
FROM elgemp
WHERE (((elgemp.ENR_LOC) Like 'Y*' Or (elgemp.ENR_LOC) Like 'Z*'))
ORDER BY elgemp.ENR_GRP_NUMBER;

Is this right method? I dont get any records when i run this query...am not sure if its coz i dont have any records or the process is wrong. Please confirm
 
You may try either:
SELECT ENR_GRP_NUMBER
FROM elgemp
WHERE ENR_LOC Like '[YZ]*'
ORDER BY ENR_GRP_NUMBER
Or
SELECT ENR_GRP_NUMBER
FROM elgemp
WHERE Left(ENR_LOC,1) In ('Y','Z')
ORDER BY ENR_GRP_NUMBER
Or (if a passthru query)
SELECT ENR_GRP_NUMBER
FROM elgemp
WHERE ENR_LOC Like 'Y%' OR ENR_LOC Like 'Z%'
ORDER BY ENR_GRP_NUMBER

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top