Table with 3 queries

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I´m stuck with a problem

I have to make a table with the information of three different queries.
The table has 4 columns x n rows. The first and second columns must be
filled with the result of the first query, the third, with the result
of the second query and the fourth with the result of the third query.
All queries has the same number of results and the count(result) > 1

I made different combinations of while's but no one seems to work.

Any help or reference???

Thanks in advance!!!


Re: Table with 3 queries

zek2005 said the following on 29/12/2005 03:08:
Quoted text here. Click to load it

How are you associating different rows of the separate queries?
e.g. if Query 1 gives:

    col1    col2
    A    X
    B    Y
    C    Z

and Query 2 gives:


and Query 3 gives:


How do you expect MySQL (are you using MySQL? You didn't actually say)  
to know how to combine these into one table?

There's nothing about that data that implies it should be combined as  

    col1    col2    col3    col4
    A    X    D    G
    B    Y    E    H
    C    Z    F    I

In which case, it's usually the wrong approach to put unrelated data  
into one table.

If the data *is* related in some way, then that means that you should be  
able to perform just one query, rather than three separate queries.


Site Timeline