Friday, 6 September 2013

assign column alias to where condition not work in sqlite

assign column alias to where condition not work in sqlite

Today I faced a problem, that below sql query is not working in sqlite but
works in mysql.
It has the same table structure both in mysql and sqlite
Table structure
========================
tablet_order | framework_item_id | framework_parent_id
1 | 1 | 0
2 | 2 | 1
3 | 3 | 2
SQL:
SELECT tablet_order AS tablet, (
SELECT framework_item_id
FROM framework
WHERE tablet_order = tablet
) AS tablet1
FROM framework
WHERE framework_item_id =1
The alias 'tablet' is assigned to tablet_order field. This made an error
in sqlite but not in mysql.
Anybody can u explain this....

No comments:

Post a Comment