Здравствуйте!
Есть вот такой запрос:
select h.id, h.obj_id, oc.rel_val as catId,oc1.rel_val as catId,oc2.rel_val as catId from cms3_hierarchy as h
join cms3_object_content as oc on h.obj_id = oc.obj_id and oc.field_id = 442
join cms3_object_content as oc1 on h.obj_id = oc1.obj_id and oc1.field_id = 443
join cms3_object_content as oc2 on h.obj_id = oc2.obj_id and oc2.field_id = 444
where h.type_id = "54"
На выходе хочу получить столбцы в виде:
id obj_id catId
143 712 321
144 713 3
234 813 33
417 1017 2
920 1582 1
1182 1848 23
1235 1901 32
1281 1947 22
1357 2031 1
1359 2033 2
1360 2034 3
2265 6611 4
5105 9840 5
5616 10381 9264
2253 6599 10663