Hi! I have in my database few tables and each table have a column with dates of inserting records. I don't know how to go through the database, through all tables, in chronological order, from the first inserted record until the last, can anyone help? tnx!

Recommended Answers

All 3 Replies

What do you mean by this statement:

"have a column with dates of inserting records"

With regard to...

I don't know how to go through the database, through all tables, in chronological order

You use a SQL SELECT statement to query the database table. If you have more than one table that has the desired information, you JOIN the tables in your SQL Query. With regard to controlling the order, you use the ORDER BY keywords in your SQL statement.

Ok, tnx, i meant that column with dates is automatically filling when i insert the record, it shows the date of the inserting. So, I wanted to go through all records in database from the first insert.

If the date column is being filled with the actual date the record is being inserted, then they should already be in order. But in any case, to sort by date, your SQL query would be something like this...

SELECT fieldDate, field2, field3 FROM table1 ORDER BY fieldDate ASC

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.