3

我有 sql 选择:

SELECT * 
FROM `fclients` AS F 
LEFT JOIN `fclients_sequens` AS FS ON F.category = FS.category 
ORDER by FS.num

我得到结果:

结果选择sql

然后,对于id第一个表中的给定,我进行 sql 查询:

SELECT *, fclients.id as fclientsID 
FROM `fclients` AS F 
LEFT JOIN `fclients_sequens` AS FS ON F.category = FS.category 
ORDER by FS.num

我得到一个错误:

#1054 -“字段列表”中的未知列“fclients.id”

请告诉我如何给id拳头列(id = 37)?

4

1 回答 1

8

引用列 ID 时需要使用别名 F

SELECT *, F.id...
于 2012-10-19T19:30:29.690 回答