※ 引述《liton (歐吉桑留學生)》之銘言:
: Proc Sql;
: create table group as
: select group, type
: from source
: where group in
: (select group, count(distinct type) from source
: 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;
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.150.51