[英]Use result of group concat in subquery Mysql
你好我想在subquery
使用行的結果
group_concat(TI2.entry_id)
其結果是例如兩個id 102,414
,這將在結果中顯示。
但是當我嘗試在另一個查詢中使用此行時
SELECT (SELECT sum(transaction_item.item_price) from transaction_item where transaction_item.entry_id IN (group_concat(TI2.entry_id))) AS new
我只為一個身份證 sum
。
知道這里有什么問題嗎,對此不使用其他查詢
嘗試在where子句中使用嵌套查詢
SELECT (SELECT sum(transaction_item.item_price) from
transaction_item where transaction_item.entry_id IN
(select group_concat(entry_id) from transaction_item group by entry_id))
AS new
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.