Log in

View Full Version : MySQL result set...but from which table?



city_coder
03-18-2010, 01:31 PM
Hi Guys,

this is a tricky one really.

so my quandary is that i have 2 tables that are not related but i want to get the 3 most recent entries from them.
so a result set could consist of:
1 result from table1
2 results from table2

or a result set could consist of:
2 results from table1
1 result from table2

and there are other patterns of results obviously.

Anyway this would make the 3 most recent entries that i want to achieve.
This is fine doing a join but my problem is when i want to kick out the results to the user & they need a link to a particular page.

For example
results from table1 would need to go to page1.php
results from table2 would need to go to page2.php

how do i differentiate which table the row from the result set came from?

I'm stuck on what to put into google really. If anyone knows a solution i would be very grateful!

Cheers

city_coder
03-18-2010, 01:59 PM
OK i figured it out (found it really).

For those who might find this later go to this page

http://lists.mysql.com/mysql/211371

hopefully that will answer any questions, but for now i'm a happy guy again :P

cheers guys & sorry for wasting your time!