---
title: "Delete if condition met in a column"  
description: "Delete if condition met in a column"  
author: "Anonymous User"  
published: 2013-04-08  
updated: 2013-04-08  
canonical: https://www.mindstick.com/forum/729/delete-if-condition-met-in-a-column  
category: "mysql"  
tags: ["mysql"]  
reading_time: 1 minute  

---

# Delete if condition met in a column

Hi [Expert](https://www.mindstick.com/articles/13120/an-expert-financial-advice-will-improve-your-finances)!\
i have a [table](https://www.mindstick.com/articles/43918/how-to-design-table-using-bootstrap) like this:\
id, senderNumber, blacklist-----------------------------1 0835636326 Y2 0373562343 Y3 0273646833 Yand I want to [delete](https://www.mindstick.com/forum/33620/how-to-delete-record-from-list-in-mvc-using-ajax) automatically if a new inserted row on another table consist anything on senderNumber [column](https://www.mindstick.com/forum/33860/how-to-calculate-column-summary-in-sql-server) above using a BASH [Script](https://www.mindstick.com/interview/477/how-can-i-execute-a-php-script-using-command-line)\
I [already](https://yourviews.mindstick.com/view/88453/the-hidden-ways-ai-is-already-controlling-your-daily-life) using this script:\
BLOCKLIST="$( [mysql](https://www.mindstick.com/articles/12156/what-is-mysql) -uroot -pabcde smsd -N -s -r -e "[SELECT](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance) senderNumber FROM blacklist WHERE senderBlock='Y'" | tr '\n' ' ')"mysql -uroot -pabcde smsd -e "DELETE FROM inbox WHERE senderNumber = '$BLOCKLIST'"and this the [output](https://www.mindstick.com/interview/34427/explain-the-output-in-angular):\
sh -x /etc/autodelete.sh+ tr \n + mysql -uroot -pabcde smsd -N -s -r -e SELECT senderNumber FROM blacklist WHERE senderBlock='Y'+ BLOCKLIST=083808034690 08164853500 + mysql -uroot -pabcde smsd -e DELETE FROM inbox WHERE senderNumber = '083808034690 08164853500 'but no luck. any help would be very appreciated.\
Thanks in [advance](https://www.mindstick.com/blog/33258/jee-mains-and-jee-advance-exams)!

## Replies

### Reply by AVADHESH PATEL

Hi Ankita!\
try this way\
mysql -uroot -pabcde smsd -e "DELETE FROM inbox WHERE senderNumber like =".$BLOCKLIST\


---

Original Source: https://www.mindstick.com/forum/729/delete-if-condition-met-in-a-column

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
