SQL中的错误(SELECT和LEFT Join)如何给id第一个表?

时间:2012-10-19 19:29:01

标签: sql select left-join

我有sql select:

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

我得到了结果:

result select sql http://i066.radikal.ru/1210/15/fa9c91a9d6b2.jpg

然后,对于第一个表中的给定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)?

1 个答案:

答案 0 :(得分:8)

引用列ID

时,需要使用别名F.
SELECT *, F.id...