Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Link results of queries

Status
Not open for further replies.

pondi

Programmer
Jun 6, 2001
32
GB
This is the result of 2 queries
Query1:
ELT EVENTS
elt1 event54
elt1 event21
elt1 event58
elt2 event45
elt2 event78

Query2:
ELT NB_EVENTS
elt1 3
elt2 2

I catch first the events for each element and then the number of events linked to an element.
I'd like to bind these 2 queries like:
ELT EVENT NB_EVENTS
elt1 evt54 3
elt1 evt21 3
elt1 evt58 3
elt2 evt45 2
elt2 evt72 2

or better, reformatting the first query like
ELT EVENT1 EVENT2 EVENT3 EVENT4
elt1 evt54 evt21 evt58
elt2 evt45 evt72

Here is my request, if any idea, help me thanx a lot!!

 
Hope you're brave!!
QUERY1:
SELECT elt1.name AS COMPONENTS, elt2.name AS SPAGHETTI_CLASSES
FROM (mlafond_elementlinks AS el_link INNER JOIN mlafond_ELEMENTS AS elt1 ON el_link.n1=elt1.id) INNER JOIN mlafond_elements AS elt2 ON el_link.n2=elt2.id
WHERE elt1.typeid=2 AND elt2.name IN (

SELECT mlafond_elements.name from mlafond_elements INNER JOIN mlafond_data ON mlafond_elements.id=mlafond_data.ownerid
WHERE mlafond_data.typeid=8 AND mlafond_data.valuer>7 AND mlafond_elements.typeid=3
AND mlafond_elements.version=[Forms]![MACCABE].combo0

)
ORDER BY elt1.name;


QUERY2:
SELECT elt1.name AS SPCOMPO, COUNT(elt1.name) AS NB_SPAGHETTI
FROM (mlafond_elementlinks AS el_link INNER JOIN mlafond_ELEMENTS AS elt1 ON el_link.n1=elt1.id) INNER JOIN mlafond_elements AS elt2 ON el_link.n2=elt2.id
WHERE elt1.typeid=2 AND elt2.name IN (

SELECT mlafond_elements.name from mlafond_elements INNER JOIN mlafond_data ON mlafond_elements.id=mlafond_data.ownerid
WHERE mlafond_data.typeid=8 AND mlafond_data.valuer>7 AND mlafond_elements.typeid=3
AND mlafond_elements.version=[Forms]![MACCABE].combo0

)
GROUP BY elt1.name
ORDER BY elt1.name;


Have fun with it, if you have any idea to make this better, tell me all; thanx.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top