If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Sub Query In Mysql

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-02-03, 21:33
ravishankar ravishankar is offline
Registered User
 
Join Date: Sep 2003
Posts: 26
Sub Query In Mysql

HI ALL :
Please not that I am trying to convert this oracle specific query to mysql but as I am using MySQL 4.0 where sub queries are not supported facing difficulty can any one suggest some equivalent MySQL query ?

update DEPARTMENT
set
CREATED = (select ID from USER where U_NAME='XXX'),
MODIFIED = (select ID from USER where U_NAME='XXX')
where
NAME in ( '00A', 'OOB', 'OOC') ;


thanks in advance

-Ravi
Reply With Quote
  #2 (permalink)  
Old 11-03-03, 02:00
aus aus is offline
Registered User
 
Join Date: Oct 2003
Location: Denver, Colorado
Posts: 137
Re: Sub Query In Mysql

How about:

SELECT @userid:=ID FROM USER WHERE U_NAME='XXX';
UPDATE DEPARTMENT SET CREATED = @userid, MODIFIED = @userid
WHERE NAME IN ('00A', 'OOB', 'OOC');

Quote:
Originally posted by ravishankar
HI ALL :
Please not that I am trying to convert this oracle specific query to mysql but as I am using MySQL 4.0 where sub queries are not supported facing difficulty can any one suggest some equivalent MySQL query ?

update DEPARTMENT
set
CREATED = (select ID from USER where U_NAME='XXX'),
MODIFIED = (select ID from USER where U_NAME='XXX')
where
NAME in ( '00A', 'OOB', 'OOC') ;


thanks in advance

-Ravi
Reply With Quote
  #3 (permalink)  
Old 11-03-03, 12:31
ravishankar ravishankar is offline
Registered User
 
Join Date: Sep 2003
Posts: 26
Thanks AUS
It is working !!!

-RAVI
Reply With Quote
  #4 (permalink)  
Old 11-03-03, 13:45
aus aus is offline
Registered User
 
Join Date: Oct 2003
Location: Denver, Colorado
Posts: 137
Glad to help
Quote:
Originally posted by ravishankar
Thanks AUS
It is working !!!

-RAVI
Reply With Quote
  #5 (permalink)  
Old 11-03-03, 18:46
GorTarD GorTarD is offline
Registered User
 
Join Date: Nov 2003
Posts: 1
really?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On