Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

sql sentence

Posted on 2016-11-30
2
Medium Priority
?
75 Views
Last Modified: 2016-12-28
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

0
Comment
Question by:Braveheartli
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 2000 total points
ID: 41908266
try:

$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  WHERE a.onay='1' LIMIT $start_from, $per_page";
0
 
LVL 1

Author Closing Comment

by:Braveheartli
ID: 41908269
thank you so much
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question