$SELECT name AS nm1 FROM student WHERE nm1 LIKE "%Wang%";
执行会报以下错误:
[Err] 1054 - Unknown column 'nm1' in 'where clause'
原因:别名只是对字段的一种引用,不能当做字段一样使用。
变通策略:
$SELECT nm1 FROM (SELECT name AS nm1 FROM student)AS temptab WHERE nm1 LIKE "%Wang%";
12月 30
$SELECT name AS nm1 FROM student WHERE nm1 LIKE "%Wang%";
执行会报以下错误:
[Err] 1054 - Unknown column 'nm1' in 'where clause'
原因:别名只是对字段的一种引用,不能当做字段一样使用。
变通策略:
$SELECT nm1 FROM (SELECT name AS nm1 FROM student)AS temptab WHERE nm1 LIKE "%Wang%";
近期评论