Filter fields

betheball

Registered User.
Local time
Today, 13:45
Joined
Feb 5, 2003
Messages
107
I am working with a what I feel is a poorly designed database. A typical record has a productID and then seven different colors. Each color is a text field with a value of "Yes" or "No". I am trying to write a query that given the ID number, will return only the fields from that record with a "Yes" value. Not sure this can be done. Visually, it would be something like:

SELECT ALL FIELD that equal 'Yes" FROM MyTable WHERE ProductID=1

Any chance something like this can be done? Once I get the SQL, then I want to write out the form field name, instead of the value so I get a list of colors available for a particular productID.
 
Code:
SELECT *
FROM tblMyTable
WHERE tblMyTable.[FieldName]"Yes",tblMyTable.[ProductID]1;

Something like this?

Why don't you use the Query constructer to set the Criteria, its easy. :)
Then, after you select your table and feilds, you just have to type Like Yes and Like 1.

Unless your Yes/No field is a Boolean and it has to be Like 0 or Like -1.

Hope this helps
 
Last edited:

Users who are viewing this thread

Back
Top Bottom