操作数应该只包含mysql查询中的1列

时间:2016-12-30 05:04:10

标签: mysql

运行此查询时出现错误。该错误表明'操作数应该只包含1列'。任何人都可以帮我这个吗?

SELECT
tender_id,
customer_code,
contact_person,
po_number,

(SELECT t1.tender_id, t2.file_no,
  CASE t1.tech_analyst 
  WHEN 'NULL or Empty' THEN t2.tech_analyst 
  ELSE t1.tech_analyst END AS tech_analyst
FROM view_sales_report AS t1
JOIN view_sales_report AS t2 
  ON (t2.file_no = t1.file_no AND t2.tech_analyst <> 'Null or Empty') LIMIT 1) as tech_analyst,

view_sales_report.category

FROM view_sales_report
ORDER BY tender_id DESC

1 个答案:

答案 0 :(得分:0)

不允许在子查询中使用多列

尝试使用类似的东西来实现你的结果..

   SELECT
   T1.PrimaryKey,
T1.SomeColumn,
MySubQuery.Col1,
MySubQuery.Col2,
MySubQuery.Col3
    From
Table1 T1
LEFT JOIN (SELECT TOP 1 Col1, Col2, Col3, Fkey FROM Table 2 ORDER BY Col1 DESC) AS MySubQuery ON T1.PrimaryKey = MySubQuery.Fkey