我需要使用子查询来命名查询中的列。我在该SELECT
部分中编写了带有子查询的语句,但收到以下错误消息(从 Codeigniter 返回):
错误号:1064
您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在第 1 行的 '(SELECT
ps_url_name
FROMproduct_selects
WHEREps_id
= '1'),psc_opt_2
A'附近使用正确的语法
SELECT
`psc_opt_1` AS (SELECT `ps_url_name` FROM `product_selects` WHERE `ps_id` = '1'),
`psc_opt_2` AS (SELECT `ps_url_name` FROM `product_selects` WHERE `ps_id` = '2'),
`psc_opt_3` AS (SELECT `ps_url_name` FROM `product_selects` WHERE `ps_id` = '3'),
`psc_opt_4` AS (SELECT `ps_url_name` FROM `product_selects` WHERE `ps_id` = '4'),
`psc_opt_5` AS (SELECT `ps_url_name` FROM `product_selects` WHERE `ps_id` = '5')
FROM (`product_stock_control`)
WHERE `psc_prod_id` = '5'
文件名:models/products_model.php
行号:602
任何想法出了什么问题?