Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > SQL Language
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 24th, 2006, 08:03 AM
Authorized User
 
Join Date: Dec 2005
Location: bangalore, karnataka, India.
Posts: 77
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to g_vamsi_krish
Default complex query

i am having clomns say c1,c2,c3,c4
if two rows contains same values in c2 and c3. i need to delete one row.
i.e say if row1 contains c2 value A and c3 value is B
if there is other row which contains c2 Value A and c3 value B.
I need to remove one record.

please help me. I am sick of it.

Regards
vamsi.

vamsi
__________________
vamsi Krishna G
mobile: 91 + 9986023966.
124 Puttappa layout new Tippasandhra,
bangalore.
Inida
Reply With Quote
  #2 (permalink)  
Old February 26th, 2006, 11:39 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,346
Thanks: 0
Thanked 5 Times in 5 Posts
Default

create an identity column on the table first, then run this code

DELETE FROM table1
WHERE identitycolumn NOT IN
( SELECT MIN(identitycolumn)
    FROm table1
    GROUP by a1,a2
)


Jim

Reply With Quote
  #3 (permalink)  
Old February 27th, 2006, 02:09 AM
Authorized User
 
Join Date: Dec 2005
Location: bangalore, karnataka, India.
Posts: 77
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to g_vamsi_krish
Default

thanks for ur help.

regards

vamsi
Reply With Quote
  #4 (permalink)  
Old February 27th, 2006, 09:48 AM
Friend of Wrox
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,346
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You are welcome

Reply With Quote
Reply


Thread Tools
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 Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
complex query... help plz hello MySQL 1 April 28th, 2007 05:48 AM
Help need with designing this complex query method Access 2 July 1st, 2005 05:29 AM
query too complex liz@trinityholdings.co.za Access 3 August 28th, 2003 09:01 AM
COMPLEX QUERY PROBLEM nikosdra Classic ASP Databases 2 July 28th, 2003 02:13 PM



All times are GMT -4. The time now is 02:38 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.