Union missing *
ajr4me opened this issue · comments
ajr4me commented
When executing:
first = db.table('whatever').where('id', '<', 10).take(5)
test = db.table('whatever').where('id', '>', 10).take(10).union(first).get()
or
first = WhateverModel.where('id', '<', 10).take(5)
test = WhateverModel.where('id', '>', 10).take(10).union(first).get()
the ORM is generating a wrong query for the second part - there is missing a * after SELECT:
(SELECT * FROM
whateverWHERE
id> %s LIMIT 10) UNION ALL (SELECT FROM
whateverWHERE
id< %s LIMIT 5)
A workaround at the moment would be:
first = db.table('whatever').select('*').where('id', '<', 10).take(5)
test = db.table('whatever').where('id', '>', 10).take(10).union(first).get()