On 20-07-2013 15:26, Mikael wrote:

SELECT
id,
(SELECT thing FROM othertable WHERE othertable.something = categories.id)
AS a,
(SELECT thing2 FROM othertable2 WHERE othertable2.something2 = categories.id)
AS b,
a / b AS c
FROM categories ORDER BY c;


Is there any way whatsoever to do this?


SELECT
  id,
  othertable.thing as a,
  othertable2.thing as b,
  othertable.thing/othertable2.thing as c
FROM categories
INNER jOIN othertable ON othertable.something = categories.id
INNER JOIN othertable2 ON othertable2.something2 = categories.id
ORDER BY c;

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to