Home » SQL & PL/SQL » SQL & PL/SQL » Query help
Query help [message #7969] Fri, 18 July 2003 17:11 Go to next message
Milton C. Craighead, Jr.
Messages: 3
Registered: July 2003
Junior Member
desperately looking for help in creating a query that will do the following.

create a script that will first delete all seniors then update class rank for a new year - that is to say, a script that makes all Jr in to Sr, So into Jr, and Fr into So. Assuming that all students advanced their class rank and that all seniors graduated.

Am I looking in the correct direction by using update with a subquery selecting s_class? Thanks.... Query will run against a oracle db using SQL*Plus...

MCCJr.
Re: Query help [message #7970 is a reply to message #7969] Fri, 18 July 2003 17:46 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
It sounds like a straightforward process:

delete
  from t
 where s_class = 'Sr';
 
update t
   set s_class = decode(s_class, 
                          'Fr', 'So',
                          'So', 'Ju',
                          'Ju', 'Sr');
Re: Query help [message #7974 is a reply to message #7970] Sat, 19 July 2003 05:10 Go to previous message
Milton C. Craighead Jr.
Messages: 1
Registered: July 2003
Junior Member
Thanks for your assistance Todd...

Regards,
MCCJr.
Previous Topic: how can it possible
Next Topic: Merging Records-Date selection
Goto Forum:
  


Current Time: Fri Mar 29 10:06:05 CDT 2024