Home > Putting the "squeal" back into SQL

Putting the "squeal" back into SQL

9th September 2005

For my long-term gaming project, State Secrets, I had to write this gem of SQL code:

SELECT c.*,length(session_id) as online FROM characters as c LEFT JOIN users as u ON u.current_char=c.id LEFT JOIN sessions as s USING (username) WHERE u.username != "admin" ORDER BY c.savvy DESC

Even now, that double join makes my eyes bleed.

Tags: computers, programming, sql