ParkerOH
ParkerOH

Reputation: 11

sql combining rows of the same primary key

In here you can see the nested or statement which allows me to combine the answers.text and answers.integer to the same table in some order

But what I would like to do is have the integers and text on the same row if they have the same submission id. How would I do that?

EDIT: The concat was supposed to combine the two on the same line, or so I thought. But it had just took out the nulls from the columns so that there were only two -> submissions and building_idquant. When before there was submission_id, building_id, and integer.

Upvotes: 0

Views: 474

Answers (1)

Zaynul Abadin Tuhin
Zaynul Abadin Tuhin

Reputation: 31991

its tough to get your expectation from image but i thought after seeing your image you need below somethin

select submission_id,building_idquant ,
    concat(CONVERT(varchar(50), submission_id),building_idquant ) as id_quant from
    (
    select distinct submission_id,building_idquant from tablename 
    ) t

Upvotes: 1

Related Questions