On 2/7/2012 1:55 PM, E3 wrote:

Hi, sorry for the easy question.

I have a table "lessons" I query this way:

"SELECT lesson_id,title,total_time FROM lessons WHERE lesson_id>=$id AND
group_id>=$group_id ORDER BY group_id,lesson_id LIMIT 0,2"

lesson_id is primary and autoincrement.

This query perfectly works and it does exactly what is supposed to do.

Then I have another table ('purchase_data'), with a column 'group_id'
(related to the 'group_id' of 'lessons' table) and a "wasPurchased" field
that can take boolean values (0 or 1: 1 meaning the related item has been
purchased).

Now, I want to modify that query to extract if the lesson has been
purchased.

SELECT lesson_id,title,total_time, wasPurchased
FROM lessons join purchase_data using (group_id)
WHERE lesson_id>=$id AND group_id>=$group_id
ORDER BY group_id,lesson_id LIMIT 0,2

--
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to