$leads['request']['leads']['add']=array(
array(
'sale' => $price,
'name' => $tema,
'status_id' => 22185907,
'tags' => 'sdmall',
'custom_fields'=>array(
array(
'id'=> 1986933,
'values'=>array(
array(
'value'=> $tema,
)
)
),
array(
'id'=> 1986931,
'values'=>array(
array(
'value'=> $name,
)
)
),
array(
'id'=> 1986929,
'values'=>array(
array(
'value'=> $phone,
)
)
),
array(
'id' => 1986927,
'values' => array(
array(
'value' => $email,
)
)
),
)
)
);
select works.*, GROUP_CONCAT(category.name SEPARATOR ',') as category
from work_category inner join works
on works.id = work_category.work_id
inner join category
on category.id = work_category.category_id
GROUP BY works.id, name