[q][i]Originally posted by: [b][b]efecto747[/b][/b][/i]
If notes and favorite_sites have no relation then trying to combine them into
one query doesn't really seem to have much advantage. You could use a UNION
query as Dan suggested which will certainly give you something along the lines
of what you're after but it you'd have to consider what performance gain you
might expect from such a move - I'd imagine the differences in performance
would be almost non-existent.
Are you sure your performance is suffering because of the queries? Have you
turned on debugging and looked at the total execution time of all queries? I'd
be looking at other aspects of the page generation before trying to combine
queries - especially if the data isn't related.[/q]
I have tried as Dan and you said, UNION query. But, thats not working either.
The queries are not really affecting that much, but i have to use this method
for my application to get things work. If i can get this to work, i'll be able
to use it atleast 3-4 times at different places.
One of the reaons i'm trying to do this:
First query gets results, sorted by date, (table 1)
Second query, use the same order of results to get results from table 2, and
output in the same order (table 2)
final output, show output sorted by date.
I think if i combine the queries into one, it would be much easier, but i cant
seem to find a solution.