I have a large statement:
SELECT
a.user_id, a.user_name,
s.name, s.value,
d.default
FROM
accounts a,
settings s
LEFT OUTER JOIN default d ON ( d.name = s.name )
WHERE
s.user_id = a.user_id;
The problem is that settings
contains a large amount of entries and I need to pick the one with the highest ID. I can imagine do change the statement and replace the join with a subselect (which grabs the correct entry from settings
), but I'm curious to see if there is a better solution. Any input is appreciated. Many thanks!