Link to home
Start Free TrialLog in
Avatar of BR
BRFlag for Türkiye

asked on

sql sentence

Dear Experts,

I need to add where clause to below sql statement. I use PHP and mysql

I'd like to add WHERE a.onay='1' to the sql statement  (  onay coloumn is on the first table )

where should I add it? I added it before LIMIT clause, but it didn't work.

$sql9 = "SELECT a.id, a.sehir, a.uid, a.baslik, a.kategori, a.fiyat, a.icerik, a.telefon, a.sontarih, a.onay ,b.ilanid ,b.resim
FROM ilan a  
LEFT JOIN
(
    SELECT ilanid, MAX(resim) resim
    FROM resimler
    GROUP BY ilanid
	DESC
)b ON a.id = b.ilanid LIMIT $start_from, $per_page";

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BR

ASKER

thank you so much