I have table X, and each record in X has many records in Y.
I want a simple SQL which brings just the records from X which has the same set of records from Y.
Each group of records from X I want it to be distinguished from other group (which has another set of records from Y) with some value.
Example:
1 - 5
- 6
2 - 3
3 - 5
- 6
4 - 3
5 - 7
I want it back as:
1 - a
3 - a
2 - b
4 - b
5 - c
This looks like a job for
wm_concatorstragg, which will give you your unique values without you having to transliterate them to something.And with your comment you can guarantee order in a sub-query:
The only problem is your values won’t be “pretty” they’ll be a concatenation of all the possible values you have in
table_x