Solved

How to delete rows from tables starting with a prefix

Posted on 2014-07-24
1
437 Views
Last Modified: 2014-07-24
I have multiple tables all starting with the prefix of pfsense_

I would like to know how I can delete all rows from the tables starting with pfsense_ where column CUUID = blah
0
Comment
Question by:ITNC
1 Comment
 
LVL 32

Accepted Solution

by:
Daniel Wilson earned 500 total points
ID: 40216821
You need to write a query that will write the final query for you.

select concat('delete from ' ,  table_name , ' Where CCUID = ''BLAH'';') from information_schema.tables where table_schema = 'MyDBName' and table_name like 'pfsense_%';

Open in new window


Paste the results of that query into a text editor to take off the | symbols.

then run that as your query.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MySQL Select latest stock count records 11 69
Best database setup for image uploads 6 63
PHP connection to remote AWS MySQL RDS 4 96
Mysql sync between 3-4 mysql db 4 33
All XML, All the Time; More Fun MySQL Tidbits – Dynamically Generate XML via Stored Procedure in MySQL Extensible Markup Language (XML) and database systems, a marriage we are seeing more and more of.  So the topics of parsing and manipulating XM…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question