質問

Now I want to group by words and see how many times they show under one ORG('DMS') and how many times it shows in other ORG ('NONDMS') files. It should looks like this:

WORD   DMS(count) NOTDMS(count)
health   118          32

Here is the code I have. I could run the piece after SELECT, but could not write it into a new file.

CREATE Table  DMSCOUNT(WORD varchar(200), DMSTotal int, NOTDMSTotal int)

INSERT INTO DMSCOUNT
SELECT Word,
       SUM(CASE WHEN ORG='DMS' THEN 1 ELSE 0 END),
       SUM(CASE WHEN ORG != 'DMS' THEN 1 ELSE 0 END)
FROM temp
GROUP BY Word;

Error message: Error at Command Line:3 Column:1 Error report: SQL Error: ORA-00922: missing or invalid option 00922. 00000 - "missing or invalid option" *Cause:
*Action:
.

Can anyone help me figure out what is the problems? FYI, this is the old post I shared the tables. Many thanks. enter image description here

役に立ちましたか?

解決

Put a semicolon ; after your create table statement like below

CREATE Table  DMSCOUNT(WORD varchar(200), DMSTotal int, NOTDMSTotal int); <-- Here

INSERT INTO DMSCOUNT
SELECT Word,
       SUM(CASE WHEN ORG='DMS' THEN 1 ELSE 0 END),
       SUM(CASE WHEN ORG != 'DMS' THEN 1 ELSE 0 END)
FROM temp
GROUP BY Word;
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top