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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL in MS Query (Mac OS X)

Status
Not open for further replies.
Aug 6, 2004
271
GB
Hi all,

this is the only place i could think of to post this. i am using Excel V.x on G4 running OS X 10.4.8.

I have connected to my access DB using an ODBC driver. Anyway io can query it with no probs. The way queries are created seem different to me than from within Access. Anyway, say i have a number of products beginning with code BAL.

I can retrieve a list of all of these by putting like 'BAL%' in the criteria box. So i get all those products whose codes start with BAL. Now there are products whose codes start with BAL and end in FB. I dont want these included in the data returned, anyone any idea to not include these?

All help much appreciateed.
 
....WHERE fieldname like 'BAL%'
AND Right(fieldname,2) <> 'FB'
oughta work!

Outside of a dog, a book is man's best friend. Inside of a dog it's too dark to read.
 
this doesnt return any results. My full SQL statement is:

SELECT Products.Code FROM Products WHERE (Products.Code like 'BAL%') AND Right(Products.Code,2) <> 'FB'

the codes look like this

BAL 1060395FB

and

BAL 1060395
 
I was able to get the result i wanted by using

SELECT Products.Code FROM Products WHERE (Products.Code like 'BAL%') AND (Products.Code NOT like '%fb%')

thanks for your help though genomon, pointed me in the right direction
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top