I need to get a result table from an sql query.
Suppose i have 2 columns A,B. The column A contains multiple values which can be similar or distinct. Column B contains only 2 values 1 or 2. I tried the group by but i am getting all the results as different rows.
How can i expect a query which can return all the distinct values of A in a single row with one value of B.
Rough Data
A | B |
---|---|
ex1 | 1 |
ex2 | 1 |
ex3 | 2 |
ex4 | 2 |
Expected Data
A | B |
---|---|
ex1,ex2 | 1 |
ex3,ex4 | 2 |
select ....
group by a,b