Hello i am trying to do this simple statement but i want to add a variable that comes from a select. Here is what i have.
userEmail varChar(50) := SELECT user_id FROM users WHERE email = '[email protected]';
SELECT *
FROM iphone_alerts
WHERE user_id = userEmail
AND date_added = (SELECT MAX(date_added) FROM iphone_alerts WHERE user_id = userEmail
Do i need to use something along the lines of Declare and Begins? I am new to the sql stuff and am having trouble finding answers.