Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Old 11-17-2010, 01:35 PM SQL query help
Red_X_'s Avatar
Extreme Talker

Posts: 158
Location: Houston
Trades: 0
Code:
DELETE FROM listings WHERE companyid IN  
(SELECT companyid FROM listings WHERE subid = '12' 
INTERSECT SELECT companyid FROM listings WHERE subid = '13') 
AND subid = '13'
Is the query I have going so far but it doesn't do exactly what I want it to do.

What I am looking for is, any companyid that is in 13 but not in 12 to be put into 12.

Any help would be appreciated. Thanks.
__________________
"Good News Everyone, by reading this your hearing my voice."
Red_X_ is offline
Reply With Quote
View Public Profile Visit Red_X_'s homepage!
 
 
Register now for full access!
Old 11-18-2010, 06:34 AM Re: SQL query help
Banned

Posts: 408
Name: mushget
Trades: 0
HTML Code:
update listings 
set subid = 12
where companyid  in (select companyid from listings where subid = '13')
mushget is offline
Reply With Quote
View Public Profile Visit mushget's homepage!
 
Old 11-18-2010, 04:56 PM Re: SQL query help
Red_X_'s Avatar
Extreme Talker

Posts: 158
Location: Houston
Trades: 0
Quote:
Originally Posted by mushget View Post
HTML Code:
update listings 
set subid = 12
where companyid  in (select companyid from listings where subid = '13')
Thanks for the reply.

I ran the query, and it didn't work. Keep in mind, I want non duplicate data -

I don't want a list thats in 12 and 13, I just want a list thats in 13 and not in 12 to be put into 12.
__________________
"Good News Everyone, by reading this your hearing my voice."
Red_X_ is offline
Reply With Quote
View Public Profile Visit Red_X_'s homepage!
 
Old 11-20-2010, 01:55 PM Re: SQL query help
Banned

Posts: 6
Trades: 0
thanks for sending me this information it was very helpful
johnmith is offline
Reply With Quote
View Public Profile Visit johnmith's homepage!
 
Reply     « Reply to SQL query help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.41781 seconds with 12 queries