亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

UNION 無(wú)法將兩個(gè)結(jié)果與同一列合并
P粉647504283
P粉647504283 2024-04-03 00:23:39
0
1
686

在這里輸入圖像描述我試圖將這兩個(gè)查詢合并在同一個(gè)顯示結(jié)果中,但是Mysql系統(tǒng)一直說(shuō)UNION不能在這個(gè)位置。如果聯(lián)合不起作用,我如何組合這兩個(gè)查詢?

P粉647504283
P粉647504283

全部回復(fù)(1)
P粉329425839

https://dev.mysql.com/doc/refman /8.0/en/union.html 說(shuō):

就您而言,它看起來(lái)像這樣:

(select customer_id, points, state from customers where state = 'CA' order by points desc limit 3)
union
(select customer_id, points, state from customers where state = 'FL' order by points desc limit 3)

您可能還想了解窗口函數(shù)一個(gè)>:

select customer_id, points, state
from (
  select customer_id, points, state, 
    row_number() over (partition by state order by points desc) as rownum
  from customers where state in ('CA','FL')
) as t
where rownum 
最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板