HaFiz Umer
HaFiz Umer

Reputation: 177

how 2 rows data concat into 1 column of a single row in mysql

In my Table sales_order_address there is 2 rows on each order, 1 record for billing to information and 2 is shipping to information. But I want to get billing and shipping address in column and single row.

You can see in screenshot Veronica6146 Honey Bluff ParkwayCaldershipping Veronica6146 Honey Bluff ParkwayCalderbilling in 2 rows how can I get into 1 column of a single row?

enter image description here

Upvotes: 1

Views: 34

Answers (1)

Fahmi
Fahmi

Reputation: 37473

use group_concat()

select order_id,group_concat(concat(first_name, street,city,address_type))
from tablename
group by order_id

Upvotes: 1

Related Questions