i have a problem to understand what happens in this query:
$db->select("select r.id, m.mailing_id, r.email,
m.done from lp_relations r, lp_mailings_relations m
where m.relation_id=r.id and m.mailing_id=? order by r.name",
$rs[$i]["id"]
its about the letters r
. and m
. before the fieldnamesthese, these aren't tablenames, but i suspect abbreviations of some kind of joins, but i have never seen them before this way.
I can rewrite my own query to get the job done, but i like to know what this means, so i can tackle the problem itself (mailing sent twice)
Thanks in advance for any help!
Look at
FROM lp_relations r, lp_mailings_relations m
.
After real table names you find a new name, used to make SELECT part shorter and easy to read.
So table lp_relations becomes r and table lp_mailings_relations becomes m!
You could write:
SELECT r.id, r.email, m.mailing_id, m.done
FROM lp_relations r INNER JOIN lp_mailings_relations m
ON m.relation_id=r.id
WHERE m.mailing_id=?
ORDER BY r.name
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With