In MySql database have AM_COURSE
UserId CourseName course_desc
101 java sometext...
102 mysql sometext....
:
AM_TIMETABLE table in that
UserId Date_Time
101 2012-08-08 04:00:00
102 2012-08-15 10:00:00
103 2012-08-18 09:00:00
104 2012-08-24 05:00:00
My Question is, i’m passing start-date and end-date and CourseName then i want to get UserId in that way i wrote query
select UserId,CourseName,course_desc from AM_COURSE where name='java' and UserId=(SELECT UserId FROM AM_TIMETABLE WHERE `Date_Time` BETWEEN '2012-08-07 00:00:00' AND '2012-08-20 00:00:00')
then i will get 101 UserId value.
but i’m getting error because inner query give two id’s… please help
If your inner query is returning more than 1 result (and this is valid of course for your scenario) then shouldn’t you be using the IN clause?