Hi folks:

Off topic, but I'm wondering if anyone has any idea of how to include table names in the result set of a UNION-like query to a MySQL DB?

I'm running with a query like this:

userRes = lasermgt.SQLSelect("Select * from reservations where fldTimestamp between '" + beforeToday.SQLDate + " 00:00:00' and '" + beforeToday.SQLDate + " 23:59:59' UNION Select * from deletedreservations where fldTimestamp between '" + beforeToday.SQLDate + " 00:00:00' and '" + beforeToday.SQLDate + " 23:59:59' order by fldTimestamp")

Since that's waaaaaay too complicated to follow, I'll clear it up a bit.

This translates into:

Select * from reservations where fldTimestamp between 'SQLDateTime' and 'SQLDateTime' UNION Select * from deletedreservations where fldTimestamp between 'SQLDateTime' and 'SQLDateTime' order by fldTimestamp;

reservations and deletedreservations are two individual tables in my database. They have identical schema.

The idea here is to return a set of results from the two tables that includes a field indicating which table it came from.

Is there an easy way to do this, or so I need to look outside of SQL commands to accomplish it?


--
 _________________________________________
|                                         |
| ED LEE               ed_lee @ ncsu.edu  |
|_________________________________________|
|                                         |
|                Windows Systems Support  |
|                      College of Design  |
|                    NC State University  |
|                           919.513.0226  |
|_________________________________________|

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to