I have a short question an I am stuck at this point. I have the following query:
SELECT A, B
FROM my_table AS r
LEFT JOIN my_table_2 AS p ON r.rs_id = p.rs_id
WHERE r.rs_id = $DB->quote($_SESSION['mysession']['id']) EXISTS (SELECT A, B, date FROM my_table WHERE date = CURDATE())';
What I am trying to do is to get results from the database. If there is a row however that has a record that matches the current date I only want to get this rows, so not all A + B anymore. If there are NO rows with a current date I want to load all A + B by default.
Does anyone knows the answer? Thanks!