Jump to content

Query all tables in a database?


Roy766

Recommended Posts

Hello all!

 

I have a database with six different tables in it ("word", "idea", etc.). Each table has a timestamp column and what I want to do is have a page that lists all the rows entered within a certain time frame (a "New" page). In order to do this, though, I would have to query all six tables and then echo the rows created within a certain time frame. Is this possible?

 

Thanks in advance!

 

Also, if anyone has a suggestion on how to return all rows from a certain date onwards, that would be appreciated too.

Link to comment
Share on other sites

It will work by the date, if the date is stored in a date, datetime, or timestamp column.  Having 6 queries in a page is a little bit of overhead, but hey, this page you are looking at was created with 16 queries (shown at the bottom).  However, storing duplicate data is not something that I would recommend.  If you are storing to two different tables, how do you handle edits, and/or deletions?

Link to comment
Share on other sites

No need for edits or deletions. If it becomes absolutely necessary I can manually edit the data, but it shouldn't be for the purpose of the site (only one person will be adding content, and he'll be copying the content from a document previously proofread and edited because he'll be printing it out as well as uploading it). In addition, there's no need to store very much content in the "new" table; any row after the most recent twenty can be automatically cleared. It's simple but efficient and works perfectly for the system I need.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.