In my MySQL database I got three tables. One is a list of items having an ID and some more columns. The second one is a list of users with first name and so on. The third on records if a user has rated and/or bought an item. The data type of the column for rated and bought will be a bit-flag (1/0).
So, now I would like to return in only one SQL query how often an item was rated and if it was rated by the specific users.
Input arguments are:
- user
- item
Result should be:
- count(rated)
- true/false(rated by specified user)