Page 1 of 1

Query problem

Posted: Wed Jun 27, 2007 9:33 am
by chiching72
Hello all,

I have a query and I'm not sure why it's giving me 2 rows of the same results. Can someone tell me what I am writing wrong?

Code: Select all

$query = "SELECT Lesson.lesson_name, Lesson.title, Lesson.content, Images.imageinfo, Images.description
				FROM Lesson, Images WHERE (Lesson.lesson_id = '$LESSON' && Images.lesson_id = '$LESSON')";
Thanks

Re: Query problem

Posted: Wed Jun 27, 2007 10:36 am
by patrikG
Try

Code: Select all

$query = "SELECT DISTINCT Lesson.lesson_name, Lesson.title, Lesson.content, Images.imageinfo, Images.description
				FROM Lesson, Images WHERE Lesson.lesson_id = '$LESSON' 
AND Images.lesson_id = '$LESSON'";

Re: Query problem

Posted: Wed Jun 27, 2007 8:46 pm
by chiching72
nope, it still gives me two results (duplicate)...

Posted: Thu Jun 28, 2007 9:29 am
by Gente
Are you sure 'lesson_id' is unique in your tables?