Alexandre Severino
Alexandre Severino

Reputation: 1613

Merging query results

I have the following subquery:

Acc    Tel            Prod1    Prod2
1000 | 281-xxx-4809 |   No  |   Yes
1000 | 281-xxx-4809 |   Yes |   No

How do I select those two columns by the Acc column into only one like this:

Acc    Tel            Prod1    Prod2
1000 | 281-xxx-4809 |   Yes |   Yes

Using SQL?

Upvotes: 0

Views: 31

Answers (1)

James Z
James Z

Reputation: 12318

Shouldn't this work?

select Acc, Tel, max(Prod1), max(Prod2)
group by Acc, Tel

It's based on alphabetical order, but that works fine for you.

Upvotes: 4

Related Questions