SQL 由于列名错误,查询无法正常工作,但该列存在
SQL Query not working due to column name error however column exists
我对以下查询有疑问:
SELECT *
FROM `pageindex`
FULL JOIN `pages` ON `pageindex`.`url` = `pages`.`page`
WHERE `pageindex`.`url` IS NULL;
我也试过这个:
SELECT *
FROM pageindex
FULL JOIN pages ON pageindex.url = pages.page
WHERE pageindex.url IS NULL;
我收到这个错误:
ERROR 1054 (42S22): Unknown column 'pageindex.url' in 'where clause'
但我不明白为什么当该列确实存在时,这里是 table:
中的列
+--------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+--------------+------+-----+---------+-------+
| url | varchar(255) | NO | PRI | NULL | |
| title | varchar(255) | YES | MUL | NULL | |
| keywords | text | YES | | NULL | |
| description | text | YES | | NULL | |
| last_updated | date | YES | | NULL | |
| heading | varchar(255) | YES | | NULL | |
| textcontent | text | YES | | NULL | |
| htmlcontent | text | YES | | NULL | |
| audiencetype | varchar(255) | YES | | NULL | |
+--------------+--------------+------+-----+---------+-------+
希望你能帮上忙,
谢谢
因为 MySQL 不支持 FULL JOIN,您的查询解释如下:
SELECT *
FROM `pageindex` AS full
JOIN `pages` ON `pageindex`.`url` = `pages`.`page`
WHERE `pageindex`.`url` IS NULL;
我对以下查询有疑问:
SELECT *
FROM `pageindex`
FULL JOIN `pages` ON `pageindex`.`url` = `pages`.`page`
WHERE `pageindex`.`url` IS NULL;
我也试过这个:
SELECT *
FROM pageindex
FULL JOIN pages ON pageindex.url = pages.page
WHERE pageindex.url IS NULL;
我收到这个错误:
ERROR 1054 (42S22): Unknown column 'pageindex.url' in 'where clause'
但我不明白为什么当该列确实存在时,这里是 table:
中的列+--------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+--------------+------+-----+---------+-------+
| url | varchar(255) | NO | PRI | NULL | |
| title | varchar(255) | YES | MUL | NULL | |
| keywords | text | YES | | NULL | |
| description | text | YES | | NULL | |
| last_updated | date | YES | | NULL | |
| heading | varchar(255) | YES | | NULL | |
| textcontent | text | YES | | NULL | |
| htmlcontent | text | YES | | NULL | |
| audiencetype | varchar(255) | YES | | NULL | |
+--------------+--------------+------+-----+---------+-------+
希望你能帮上忙,
谢谢
因为 MySQL 不支持 FULL JOIN,您的查询解释如下:
SELECT *
FROM `pageindex` AS full
JOIN `pages` ON `pageindex`.`url` = `pages`.`page`
WHERE `pageindex`.`url` IS NULL;