Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6995121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:58:50+00:00 2026-05-27T19:58:50+00:00

I have this query that works fine. Its deletes records that are old based

  • 0

I have this query that works fine. Its deletes records that are old based on current time.

$cleanacc_1 = "DELETE FROM $acc_1 
    WHERE `Scheduled` < DATE_SUB(UTC_TIMESTAMP(), INTERVAL 30 SECOND)";

$result = mysql_query($cleanacc_1);

However, there are over 100 tables (accounts) that need deleting and I was wondering if I can combine them into one query. If possible how?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:58:50+00:00Added an answer on May 27, 2026 at 7:58 pm

    This implies you create a new table for every account. Why are you not creating a record for each account within a single table?

    For example…

    create table account (id int unsigned primary key auto_increment, other fields...);
    

    If you alter your table structure you will be able to delete individual account records with a single query…

    delete from account where condition=true;
    

    Individual transaction records for each account are then stored in another table and contain the account id they relate to…

    create table transaction (id, account_id, other transaction fields);
    

    If you don’t change the database design you’ll need to write PHP code that loops through each table and runs your delete query. This is very inefficient and I urge you to redesign the table as suggested.

    If you don’t understand why my table redsign suggestion is a better approach, post more information about your database and I’ll explain in more detail with a working example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have this query that works perfectly: SELECT users.*, GROUP_CONCAT(categories.category_name) AS categories FROM
I have this linq query that works well (although it may be written better,
I have this query that, due to the number of records, is taking several
I have a linq query that works just fine but when StyleCop is run
I have a stored procedure that works fine on its own. A recent requirement
I have this query that returns the results by ordering it by focus.name ASC.
I have this query that inserts rows, using a subquery like so: INSERT INTO
I have have this query that i want to execute. SELECT warehouse.expiry_date, pharmacy.expiry_date, drugs.active_substance,
I have this SQL Query that pulls data from 3 tables. I am unable
I have this working query that outputs URL and click counts from database. <?php

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.