Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old February 16th, 2005, 06:45 AM
evergreenfall evergreenfall is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Feb 2005
Posts: 1 evergreenfall User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 m 18 sec
Reputation Power: 0
Tricky Problem

Hi friends,


I have one doubt Just see.

We have one table TAB1

A B C
1 1 1
1 1 1
1 1 1
2 2 2
2 2 2

ok?


Now if we want to delete some record without using Procedures so that final data in the table will be

A B C
1 1 1
2 2 2


we have to delete that data just see if anybody can find out the logic.

Bye

Reply With Quote
  #2  
Old February 16th, 2005, 07:12 AM
Dumbo Dumbo is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 29 Dumbo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 27 m 31 sec
Reputation Power: 0
I'm missing the point of this problem....

Why not use a procedure?
Can you use a temporary table?
If so just run the following commands:
select distinct a,b,c into #temp from tab1
delete from tab1
insert into tab1 select * from #temp
drop table #temp
If you may add an identity column to tab1 you could use one statement:
delete from tab1 where row_id not in (select min(row_id) from tab1 group by a,b,c)

Reply With Quote
  #3  
Old February 23rd, 2005, 10:56 AM
csdstudent csdstudent is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 36 csdstudent User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 50 m 11 sec
Reputation Power: 5
If you look for a mathematic approach search for topics related to linear algebra used for computer science.

Reply With Quote
  #4  
Old February 24th, 2005, 04:14 AM
A2k's Avatar
A2k A2k is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 166 A2k User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 h 44 m 10 sec
Reputation Power: 4
surely this is a simple case of using a select distinct, job done.

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > Tricky Problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT