June 22, 2012 at 9:56 am
Hi friends ,
I need to Delete from table with conditions :
Example of my query!!!
Delete from TAble A where Input_type like 'COLD%' and Input_type like 'ChartMover%'
when I try to exceute the above query the result show '0 rows affected'
where as when I try to check using "selete" actually there are records with "Input_type like 'ChartMover%'"
But my delete is not working with same column to delete with 2 different likes??
IS my query incorrect??
Can anyone suggest
Thanks in advance!!
June 22, 2012 at 10:00 am
look at the WHERe statement in your query:
where Input_type like 'COLD%'
and Input_type like 'ChartMover%'
it is impossible a string could START with both 'COLD%
and 'ChartMover% at the same time.
it's one OR the other; that's why no rows are affected.
your SELECT query 's WHERE statement needs to exactly match your Delete to affect the same rows!
here's what i suspect you want: to delete both types:
Delete
--SELECT *
from TAble A
where Input_type like 'COLD%'
OR Input_type like 'ChartMover%'
Lowell
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply