Delete a single value from table

Posted by Chaithragm under Sql Server on 3/14/2013 | Points: 10 | Views : 1638 | Status : [Member] | Replies : 6
i want sql query to delete ward
here is the columns of wardwise table
zone wards
south -w1
south -w2
south -w3
North -w1
North -W2
North -w3

i want to delete w1 from wardwise where zone=south
if i do so w1 from north is also deleted




Responses

Posted by: Jayakumars on: 3/14/2013 [Member] [MVP] Bronze | Points: 25

Up
0
Down
hi

try this Query

Select * from tablename where Wards='w1' and Zone='south'


mark as answer this useful to you.

Mark as Answer if its helpful to you

Chaithragm, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Satyapriyanayak on: 3/14/2013 [Member] [MVP] Silver | Points: 25

Up
0
Down
DELETE FROM Table1
WHERE (wards = 'w1') AND (zone = 'south')

If this post helps you mark it as answer
Thanks

Chaithragm, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Murugavelmsc on: 3/14/2013 [Member] Starter | Points: 25

Up
0
Down

delete from wardwise where Wards='w1' and Zone='south'


Regards,
Murugavel S
murugavel.sadagopan@gmail.com
http://murugavelmsc.blogspot.in/

Chaithragm, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sqldev on: 3/15/2013 [Member] Starter | Points: 25

Up
0
Down
Hi,

Try the below code.



DELETE FROM wardwise
WHERE wards = 'w1'
AND zone= 'south '


This code will use both the conditions and it will delete only 1 record which you want to delete.

Hope this information helps you.

Wth Best Regards,
SQL Blogger
http://learnsqltips.blogspot.com/
http://www.youtube.com/user/TheSSScreations

Chaithragm, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sandeepmhatre on: 4/11/2013 [Member] Starter | Points: 25

Up
0
Down
DECLARE @table TABLE (dataVARCHAR(20))

INSERT INTO @table VALUES ('not duplicate row')

INSERT INTO @table VALUES ('duplicate row')

INSERT INTO @table VALUES ('duplicate row')

SET ROWCOUNT 1

DELETE FROM @table WHERE data = 'duplicate row'

SET ROWCOUNT 0


Sandeep M,
Software Developer
Follow me on :
http://sandeepmhatre.blogspot.in

Chaithragm, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sriramnandha on: 5/11/2013 [Member] Starter | Points: 25

Up
0
Down


DELETE FROM WARDS WHERE WARD='W1' ZONE='SOUTH'




sriram

Chaithragm, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response