mysql - How to group the different values of same field -
i have written
select distinct r.id_destination , lo.location1 , lo.location2 , lo.destination , lo.zip , ld.id_field , da.identification entity , da.data pl_records r join pl_records_detail rd on r.id_order = rd.id_order left join pl_attribue @ on rd.product_attribute_id = at.id_product_attribute left join pl_profile pr on at.id_attribute = pr.id_attribute join pl_location lo on r.id_address_delivery = lo.id_address join pl_situation si on r.current_state = si.id_order_state left join pl_location_detail on r.id_cart = ld.id_cart left join pl_data da on ld.id_field = da.id_field r.id_record = 6
it returns output gets repeated because of fields " entity" , "data" contain many values!
id_destination location1 location2 destination zip id_field entity data 55 east coast street on cn 454 28 89 please process safe standards 55 east coast street on cn 454 28 90 payment cod 55 east coast street on cn 454 28 78 updates not necessary 55 east coast street on cn 454 28 92 no withdrawal of details 55 east coast street on cn 454 28 99 added records
how possible prevent duplication of values? or possible how group different values of last 2 fields
perhaps looking group_concat()
?
select r.id_destination, lo.location1, lo.location2, lo.destination, lo.zip, group_concat(distinct ld.id_field) id_fields, group_concat(distinct da.identification) entities da.data pl_records r join pl_records_detail rd on r.id_order = rd.id_order left join pl_attribue @ on rd.product_attribute_id = at.id_product_attribute left join pl_profile p on at.id_attribute = pr.id_attribute join pl_location lo on r.id_address_delivery = lo.id_address join pl_situation si on r.current_state = si.id_order_state left join pl_location_detail on r.id_cart = ld.id_cart left join pl_data da on ld.id_field = da.id_field r.id_record = 6 group r.id_destination, lo.location1, lo.location2, lo.destination, lo.zip
Comments
Post a Comment