I've got two important tables.

One has a list of questions within categories...
One has a rating for questions the user chose to give points to...

Columns in table1 (questions) are:
id
question
category_id

Columns in Table2 (rating) are:
id
q_id
rating
user_ip
time
c_id

The query i am using is :
[code=sql]...