Home » SQL & PL/SQL » SQL & PL/SQL » Very new to SQL... syntax error problem
Very new to SQL... syntax error problem [message #413205] Tue, 14 July 2009 15:20 Go to next message
killyridols
Messages: 2
Registered: July 2009
Junior Member
This is what I'm putting in:

select unique count(*) maxi,sample_id from revdat
where sample_id between 1 and 1200
group by sample_id into temp test;

Im getting a "missing operator" error message for:
"unique count(*) maxi"

This is actually somebody else's script from the 80's that I am trying to put back together now with Access. I really have no idea what I'm doing.
...Anyone know what the problem is?
Re: Very new to SQL... syntax error problem [message #413207 is a reply to message #413205] Tue, 14 July 2009 15:22 Go to previous messageGo to next message
BlackSwan
Messages: 25041
Registered: January 2009
Location: SoCal
Senior Member
>This is actually somebody else's script from the 80's that I am trying to put back together now with Access.
Then why are you posting in an Oracle forum?

UNIQUE is not valid for SELECT

>I really have no idea what I'm doing.
Obviously

>...Anyone know what the problem is?
PEBKAC
Re: Very new to SQL... syntax error problem [message #413208 is a reply to message #413207] Tue, 14 July 2009 15:27 Go to previous messageGo to next message
Michel Cadot
Messages: 64120
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Quote:
UNIQUE is not valid for SELECT

It is, it is the ANSI flavour for DISTINCT and Oracle supports it:
SQL> select unique deptno from emp;
    DEPTNO
----------
        30
        20
        10

3 rows selected.


@OP

But "into temp test;" after group by is not valid.
Use SQL*Plus and copy and paste your session... if you are using Oracle which is the purpose of this site.

Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter), use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).

Regards
Michel

[Updated on: Tue, 14 July 2009 15:28]

Report message to a moderator

Re: Very new to SQL... syntax error problem [message #413212 is a reply to message #413207] Tue, 14 July 2009 15:42 Go to previous messageGo to next message
killyridols
Messages: 2
Registered: July 2009
Junior Member
yo Blackswan, no need to be so harsh, I said I know nothing about this and was seeking help from people that do! If this is the wrong forum I apologize.
Gosh, you just seem like a very angry person. I suggest you leave the computer, go outside, and get some sunshine. Oh, and stop using lame computer jokes like PEBKAC.

Michel Cadot, thank you for the response.
Re: Very new to SQL... syntax error problem [message #413221 is a reply to message #413205] Tue, 14 July 2009 16:51 Go to previous messageGo to next message
Littlefoot
Messages: 20896
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
killyridols wrote on Tue, 14 July 2009 22:20
This is actually somebody else's script from the 80's that I am trying to put back together now with Access.

"Access" as Microsoft Access? If so, well, this is Oracle forum so - perhaps you should find Access one.
Re: Very new to SQL... syntax error problem [message #413387 is a reply to message #413205] Wed, 15 July 2009 08:24 Go to previous messageGo to next message
joy_division
Messages: 4640
Registered: February 2005
Location: East Coast USA
Senior Member
From the 80's? Access didn't exist back then, so was this an Oracle query you are trying to reconstruct? that syntax was never valid in Oracle as far as I know.
You say you are trying to reconstruct it, but what was the original code?

Re: Very new to SQL... syntax error problem [message #413449 is a reply to message #413387] Wed, 15 July 2009 15:36 Go to previous messageGo to next message
Littlefoot
Messages: 20896
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
This is how I understood it: the script was written in 1980's. He has found it somewhere. Now he'd want to put it back together with Access.
Re: Very new to SQL... syntax error problem [message #413568 is a reply to message #413449] Thu, 16 July 2009 08:07 Go to previous message
joy_division
Messages: 4640
Registered: February 2005
Location: East Coast USA
Senior Member
Yes, I understood it that way too. What I was asking is what database or language was it originally written in and what did the code look like. Must be dome form of SQL-86.
Previous Topic: sorting by same date type column in different tables
Next Topic: How to get the output of SQL%ROWCOUNT inside a procedure to the spool file.
Goto Forum:
  


Current Time: Tue Dec 06 11:59:32 CST 2016

Total time taken to generate the page: 0.10295 seconds