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

Query to Show Fields with particular content

Status
Not open for further replies.

matthoward

Technical User
Nov 21, 2002
22
GB
I am looking for a query which most people probably no the answer to but I am having a mental block on. I need to be able to run the query so it will bring up all records with the name "Trust" in the field. The other question is how do I do a query to exclude certain records that contain a particular field as I now how to include to certain records which contain content not vice versa. For example
A table which has product type. contains fields atn, atx, atw, btw, bcw, zzz, ttt, def,
I need to find a way to not display btw and bcw fields.

Cheers and thanks heaps in advance Matt
 
Here are the SQL answers (you can easily paste the code in SQL View and then go back to Design View if you're more comfortable with it).

Where the name is "Trust"
Code:
SELECT * FROM YourTableName WHERE YourFieldName = 'Trust'
If you want names that are like "Trust", including "Trusty" and "Pre-Trust," use this:
Code:
SELECT * FROM YourTableName WHERE YourFieldName LIKE '%Trust%'

Where the type isn't "btw" or "bcw":
Code:
SELECT * FROM YourTableName WHERE YourFieldName <> 'btw' AND YourFieldName <> 'bcw'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top