Display two related SQL results in a row
Posted: Tue May 12, 2009 1:24 pm
Hi,
I am trying to display some results from an SQL query in the form of a table.
The situation:
I have two tables linked by an id ie
Table 1: enclosureID(key), orderNo
Table 2: controID(key), enclosureID
Where the two enclosureID's and related with 1-Many (table1 - table2)
For every table1.enclosureID the is two controlID entries.
I want to display the results when I join these two tables together, which I can do, but I want to display it like:
enclosureID orderNo controlID controlID
and not:
enclosureID orderNo controlID
enclosureID orderNo controlID
So basically I want the results to come back on one line with one enclosureID having two controlID's rather than having two rows per enclosure.
Has anyone got any way of doing this?
I hope I have explained the situation well enough. Thanks in advance.
//mark
I am trying to display some results from an SQL query in the form of a table.
The situation:
I have two tables linked by an id ie
Table 1: enclosureID(key), orderNo
Table 2: controID(key), enclosureID
Where the two enclosureID's and related with 1-Many (table1 - table2)
For every table1.enclosureID the is two controlID entries.
I want to display the results when I join these two tables together, which I can do, but I want to display it like:
enclosureID orderNo controlID controlID
and not:
enclosureID orderNo controlID
enclosureID orderNo controlID
So basically I want the results to come back on one line with one enclosureID having two controlID's rather than having two rows per enclosure.
Has anyone got any way of doing this?
I hope I have explained the situation well enough. Thanks in advance.
//mark