This query does not not work:
SELECT
user.user_id,
user.lastname,
(SELECT
reg_fee
FROM event
where event_name = (SELECT event_joined from user)
FROM user WHERE user.registration_type=1 AND user.payment_status=1
What is the problem?
You’re missing a closing parenthesis on the first inner
SELECT, but I’m not certain this will get what you want anyway.This can be done a little more cleanly (and probably a lot faster) with a
JOIN, assuming I gleaned the table structure correctly, anduser.event_joined = event.event_name