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@email.com';
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.
If you want to do this in SQL, you’d want something like
Probably more efficient would be something like this that lets us hit the IPHONE_ALERTS table just once.