Hi, I have two tables: user_badgesand a badgestable, the following table data user_badges:
id | user_id | badge_id | points_earned | badges_awarded |
1 2324 0 5 0
If the user meets the minimum required points, i.e. 5 from the table badges, SQL will update the above as:
id | user_id | badge_id | points_earned | badges_awarded |
1 2324 1 5 1
If in the future a new point is registered for the same user, the icons user_tablewill add a new line as follows:
id | user_id | badge_id | points_earned | badges_awarded |
1 2324 1 5 1
2 2324 0 7 0
Above problem solved
This is the table badges:
badge_id | badge_name | required_points
1 new 5
2 adv 10
Below i need
The problem is that I need a query to compare a table user_badgeswith a table badges, provided that the query needs to know whether the icons were checked earlier or not.
I use this for Zend applications, I need a solution for this problem ...