Can anybody know how to set alias after 'where'? select 1 as A, 2 as B,A-B as C from tbl where =1
V Vincent Choy Dec 9, 2004 #1 Can anybody know how to set alias after 'where'? select 1 as A, 2 as B,A-B as C from tbl where =1
B Brian Dec 9, 2004 #2 Vincent Choy said: Can anybody know how to set alias after 'where'? select 1 as A, 2 as B,A-B as C from tbl where =1 Click to expand... Don't use the alias in the WHERE clause, use the actual field name or expression: select Field1 as A, Field2 as B, Field1-Field2 as C from tbl where Field2 = 1
Vincent Choy said: Can anybody know how to set alias after 'where'? select 1 as A, 2 as B,A-B as C from tbl where =1 Click to expand... Don't use the alias in the WHERE clause, use the actual field name or expression: select Field1 as A, Field2 as B, Field1-Field2 as C from tbl where Field2 = 1
V Vincent Choy Dec 10, 2004 #3 it' Great! Thanks Dunc SELECT A, B, A-B AS C FROM (SELECT 1 AS A, 2 AS B FROM tbl ) MySubQuery WHERE B = 1 it works fine! Now we can convert from access to mysql (without view function) easily
it' Great! Thanks Dunc SELECT A, B, A-B AS C FROM (SELECT 1 AS A, 2 AS B FROM tbl ) MySubQuery WHERE B = 1 it works fine! Now we can convert from access to mysql (without view function) easily