I have two columns in a table. I need to merge these two columns into 1 column, while making sure all the values in the resulting column are unique (no repetition of the IDs) ex:
ChildCard PrimaryCard
123456 123456
123450 123456
123446 123446
123456 123446
156456 155456
157456 155456
121290 124290
234567 204567
Result
CardID
123456
123450
123446
123456
156456
157456
121290
234567
124290
204567
Any help would be great here.
Thanks.
SELECT ChildCard AS CardID FROM tbl UNION SELECT PrimaryCard FROM tbl
This should give you a list of distinct card entries, both child and primary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With