Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Queries Help
Simpler
SQL> select * from testab;
CODE TYPE
---------- ----------
5 1 6 2
SQL> UPDATE testab SET code = type, type = code;
2 rows updated.
SQL> select * from testab;
CODE TYPE
---------- ----------
1 5 2 6
Regards
Naveen
-----Original Message-----
Sent: Thursday, January 30, 2003 1:09 PM
To: Multiple recipients of list ORACLE-L
Hi Ranganath,
the query for ur first question is
update testtab t1 set t1.code = ( select t2.type from testtab t2 where t1.rowid = t2.rowid ) , t1.type= ( select t2.code from testtab t2 where t1.rowid = t2.rowid )
...will let u know if i can get a query for ur second question.
Regards,
Prem Khanna J.
On Thu, 30 Jan 2003 Krishnaswamy, Ranganath wrote :
>Hi List,
>
>I need the queries for the following requirements. Can anybody
>help me
>please?
>
>1. A table has two columns "Code" and "Type". Form a query to
>swap the
>values of these columns.
>
>2. A table contains empid, salary, mgr_id. Form a query to
>select the
>employees who have the salary more than their manager's salary.
>And if the
>mgr_id is null then that record should not be selected.
>
>Thanks and Regards,
>
>Ranganath
-- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: oraora oraora INET: oraoraora_at_rediffmail.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). DISCLAIMER: This message (including attachment if any) is confidential and may be privileged. Before opening attachments please check them for viruses and defects. MindTree Consulting Private Limited (MindTree) will not be responsible for any viruses or defects or any forwarded attachments emanating either from within MindTree or outside. If you have received this message by mistake please notify the sender by return e-mail and delete this message from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change and MindTree shall not be liable for any improper, untimely or incomplete transmission. -- Please see the official ORACLE-L FAQ: http://www.orafaq.net -- Author: Naveen Nahata INET: naveen_nahata_at_mindtree.com Fat City Network Services -- 858-538-5051 http://www.fatcity.com San Diego, California -- Mailing list and web hosting services --------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Thu Jan 30 2003 - 02:53:58 CST
![]() |
![]() |