4 ms·
I also prefer using id instead of user_id or company_id. It does mean you'll have to escape it (in MySQL at least) if you are writing pure SQL. Take the follow
by nodesocket 9y ago
I also prefer using id instead of user_id or company_id. It does mean you'll have to escape it (in MySQL at least) if you are writing pure SQL.
Take the following example:
SELECT s.`id`,
s.label,
s.`group`,
g.name AS group_name,
s.tags,
s.ssh_username,
s.ssh_port
FROM servers s
LEFT OUTER JOIN groups g
ON s.group = g.`id`
ORDER BY s.label ASC
In an unrelated note, how does everybody else format their SQL? The above format is what I typically use.
- combatentropy 9y agohttps://news.ycombinator.com/item?id=12861805 https://news.ycombinator.com/item?id=12861805