Re: SQL PLUS SELECT STATEMENT - HELP ME ASAP!!!
Date: 1995/10/04
Message-ID: <NEWTNews.812846658.11957.gbbull_at_GBBULL.uswc.uswest.com>#1/1
In article <44uhcm$5i4_at_centauri.hq.nasa.gov>, <kconboy_at_boeing.hq.nasa.gov> writes:
> Path: da_vinci!newsat!uunet!in2.uu.net!usc!usc!elroy.jpl.nasa.gov!lll-winken.llnl.gov!ames!newsfeed.gsfc.nasa.gov!centauri.hq.nasa.gov!newsadm
> From: kconboy_at_boeing.hq.nasa.gov
> Newsgroups: comp.databases.oracle
> Subject: SQL PLUS SELECT STATEMENT - HELP ME ASAP!!!
> Date: Wed, 04 Oct 95 13:40:32 PDT
> Organization: NASA Headquarters
> Lines: 33
> Message-ID: <44uhcm$5i4_at_centauri.hq.nasa.gov>
> NNTP-Posting-Host: 131.182.122.114
> Mime-Version: 1.0
> Content-Type: TEXT/PLAIN; charset=US-ASCII
>
>
> I am currently taking a class with a project in SQLPLUS for Oracle. I can do the same
> SQL SELECT statement in Foxpro 2.6 with no problem, but cannot do it the same way in
> SQLPLUS. Here is the problem:
>
> I have two tables:
> Student - St_no, St_fname, St_mname, St_lname
> Enroll - St_no, course
>
> I am trying to create the following listing:
>
> St_no, St_fname, St_mname, St_lname, load_this_semester (count of
> enrollment records for each student).
>
> In Foxpro my select statement is:
>
> SELECT Student.St_no, Student.st_fname, Student.st_mname,
Student.st_lname,
> COUNT(Enroll.St_no)
> FROM Student, Enroll
> WHERE Enroll.St_no = Student.St-no
> GROUP BY Student.St_no;
>
> In SQLPLUS this statement works fine if I leave the student name
fields out, but,
> of course, it only lists the student number and enrollment count.
>
> What is the correct syntax to get the output that I need?
>
> Please help. This is due next Wednesday, and I can't find an Oracle book or
user
> anywhere here, only Sybase.
>
> THX.
>
> Kelly Ann Conboy
>
Try:
SELECT Student.St_no, Student.st_fname, Student.st_mname, Student.st_lname, COUNT(Enroll.St_no) FROM Student, Enroll WHERE Enroll.St_no = Student.St-no GROUP BY Student.St_no, Student.st_fname, Student.st_mname, Student.st_lname;
Jerry.
Jerry Bull, MTS voice: (303) 624-3073 U S WEST Information Technologies fax: (303) 624-8462 931 14th Street, Suite 920 email: gbbull_at_denitqm.mnet.uswest.comDenver, CO 80202
Received on Wed Oct 04 1995 - 00:00:00 CET