dimanche 17 juillet 2016

query with union, join and limit (not working)

i am stuck with a problem please Help

sql = mysqli_query($con, "


SELECT piadi, debtorfullName, ClientAddress, mobilePhone, principalAmount, totalAmount, status, product_name,comment ,postdate 
FROM portfeli_0 
INNER JOIN komentarebi 
ON portfeli_0.piadi=komentarebi.person_id 
WHERE portfeli_0.user='$user'

UNION ALL 
SELECT piadi, debtorfullName, ClientAddress, mobilePhone, principalAmount, totalAmount, status, product_name,comment ,postdate 
FROM portfeli_1 
INNER JOIN komentarebi 
ON portfeli_1.piadi=komentarebi.person_id 
WHERE portfeli_1.user='$user' 

");

in komentarebi i have multiple records with same person_id and i have to take only 1 of them is it possible?

Aucun commentaire:

Enregistrer un commentaire