![]() You can script a change to the HAVING clause here to see if there are x tables which contain the value. This means of all tables involved, there is only one instace of the values returned, and it joins against the original unique value list again to determine what the source table is. The second query looks to look up the Source table name against the original unique value query for all values which have a count of 1, post aggregation. It is looking across all tables and creating a unique list of values from the specified field. The first table is the one you would need to script out if columns\tables changed. ON qry_002_TableValues_Unique.MyValue = qry_001_TableValues_ALL.MyValue Qry_003_TableValues_UniqueWithSource: SELECT qry_002_TableValues_Unique.MyValue, qry_001_TableValues_ALL.SourceįROM qry_002_TableValues_Unique INNER JOIN qry_001_TableValues_ALL HAVING (((Count(qry_001_TableValues_ALL.MyValue))=1)) Qry_002_TableValues_Unique: SELECT qry_001_TableValues_ALL.MyValue UNION SELECT Table3.MyValue, "Table3" AS Source SELECT Table2.MyValue, "Table2" AS Source Qry_001_TableValues_ALL SELECT Table1.MyValue, "Table1" AS Source The following code assumes values in the tables are unique within each table. ![]() In the way I show below, I don't think it would be the most efficient, query-wise, but would be relatively easy to script. Varying column names, table names, and uniqueness thresholds across all tables would make it a bit more difficult. I think the challenge here is the open-endedness of the problem you are trying to solve. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |