Table Users : user_id , credits_available
Table Survey : user_id, survey_id, credits_required
Now I want to calculate the difference between credits_available and credits_required for a particular user_id and specified survey_id ? Is it possible to write a single query instead of calculating separately by 2 different queries?
MySQL lets you use normal math…
And of course,
$surveyIDis a variable which lists the survey ID in question…$userIDis a variable which lists the user ID in question…