I have a query:
SELECT * FROM wp_silumos_suvartojimas
WHERE katiline_name = 'Dukstynos mikrorajonas'
GROUP BY kainam2
ORDER BY kainam2 ASC
LIMIT 10
Results grouped:
Results not grouped:
UPDATED:
Group my resultset by a specific field (kainam2), and where a record from within the group has a specific value of adresas, then return that record for the group; where no record from within the group has the specified value of adresas, then return a random record for the group;
As you can see rows with ID's 22 and 164 have same kainam2 values. But in grouped results I'm getting only 1 row and I want to control which one. I want to match it against column adresas: if $some_var = adresas