看板 Statistics 關於我們 聯絡資訊
※ 引述《a15321 (a15321)》之銘言: : ※ 引述《liton (歐吉桑留學生)》之銘言: : : Proc Sql; : : create table group as : : select group, type : : from source : : where group in : : (select group, count(distinct type) from source 把這一行的count(distinct type)拿掉 變成(select group from sourse 就行了 : : group by group : : having count(distinct type)>1); : : quit; : : 你很多類似問題.. : : 建議你買本入門的SQL : 感謝,但我跑出來是錯誤訊息 @@ : ERROR: A subquery cannot select more than one column. : ERROR: A Composite expression (usually a subquery) : is used incorrectly in an expression. : 馬上google惡補了一下一些基礎 : 請問這段如果改成這樣會是一樣嗎 : PROC SQL; : CREATE TABLE new AS : SELECT group, type, COUNT(DISTINCT type) : FROM source : GROUP by group : HAVING COUNT(DISTINCT type)>1; : quit; 你這樣也行 甚至第三行不用加count(distinct type)也行 只是資料順序會跑掉 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.109.40.59