Wordpress ACF refeater ашигласан бол дараах байдлаар query бичиж DATA-гаргаж авна

select n1.post_id, n1.b1, n2.b2, n3.b3, n4.b4, n5.b5, n6.b6, n7.b7 
from (
select 
post_id, 
SUBSTRING_INDEX(meta_key,'_', 2) as bagana,
meta_value as b1 
from wp_postmeta 
WHERE meta_key LIKE 'sport_%_sport_angilal' 
) n1
INNER JOIN (
SELECT
post_id, 
SUBSTRING_INDEX(meta_key,'_', 2) as bagana,
meta_value as b2 
from wp_postmeta 
WHERE meta_key LIKE 'sport_%_Sport_turul' ) n2
on n1.post_id=n2.post_id and n1.bagana= n2.bagana
INNER JOIN (
SELECT
post_id, 
SUBSTRING_INDEX(meta_key,'_', 2) as bagana,
meta_value as b3 
from wp_postmeta 
WHERE meta_key LIKE 'sport_%_year' ) n3
on n1.post_id=n3.post_id and n1.bagana= n3.bagana
INNER JOIN (
SELECT
post_id, 
SUBSTRING_INDEX(meta_key,'_', 2) as bagana,
meta_value as b4 
from wp_postmeta 
WHERE meta_key LIKE 'sport_%_naadam' ) n4
on n1.post_id=n4.post_id and n1.bagana= n4.bagana
INNER JOIN (
SELECT
post_id, 
SUBSTRING_INDEX(meta_key,'_', 2) as bagana,
meta_value as b5 
from wp_postmeta 
WHERE meta_key LIKE 'sport_%_aldar_tsol' ) n5
on n1.post_id=n5.post_id and n1.bagana= n5.bagana
INNER JOIN (
SELECT
post_id, 
SUBSTRING_INDEX(meta_key,'_', 2) as bagana,
meta_value as b6 
from wp_postmeta 
WHERE meta_key LIKE 'sport_%_erdmiin_tsol' ) n6
on n1.post_id=n6.post_id and n1.bagana= n6.bagana
INNER JOIN (
SELECT
post_id, 
SUBSTRING_INDEX(meta_key,'_', 2) as bagana,
meta_value as b7 
from wp_postmeta 
WHERE meta_key LIKE 'sport_%_amjilt' ) n7
on n1.post_id=n7.post_id and n1.bagana= n7.bagana
ORDER BY n1.post_id DESC