Query help [message #7969] |
Fri, 18 July 2003 17:11 |
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 |
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');
|
|
|
|