Return only "Yes" values - multiple fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a "USER" table related one-to-many to seven other tables, one for each
system the user has access to. Each of those with Yes/No fields for every
aspect of the system the user has access to.

I want to build a query that returns only those fields with a "Yes" answer
from all seven tables. Since all together there could be approximately 70
fields, how can I do this? Thank you.
 
Hi,


The field name is not part of the (accessible) data, at least, not easily,
not in SQL. You have to change the design of the table to make it "as data":

you can use:


SELECT User, "System1" As System, System1 As Access FROM myTable
UNION ALL
SELECT User, "System2", System2 FROM myTable
UNION ALL
....
SELECT User, "System70", System70 FROM myTable



and then use that query, a little bit like

SELECT * FROM myUnionAllQuery WHERE Access



Hoping it may help,
Vanderghast, Access MVP
 
Thanks V....I will work with your suggestion, I appreciate your help
--
Jeff C
Live Well .. Be Happy In All You Do


Michel Walsh said:
Hi,


The field name is not part of the (accessible) data, at least, not easily,
not in SQL. You have to change the design of the table to make it "as data":

you can use:


SELECT User, "System1" As System, System1 As Access FROM myTable
UNION ALL
SELECT User, "System2", System2 FROM myTable
UNION ALL
....
SELECT User, "System70", System70 FROM myTable



and then use that query, a little bit like

SELECT * FROM myUnionAllQuery WHERE Access



Hoping it may help,
Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top