15. juni 2004 - 11:05Der er
6 kommentarer og 1 løsning
Forespørgsel ud fra 3 andre forspørgsel.
Jeg har 3 forspørgsler som ser ud som følger:
SELECT Kategorier.Kategori, Count(Arbejdere.ID) AS AntalOfID FROM Arbejdere RIGHT JOIN Kategorier ON Arbejdere.Kategori1=Kategorier.id WHERE Arbejdere.Aktiv=True GROUP BY Kategorier.Kategori;
Dette tæller antallet af arbejdere i forskellige kategorier i kategori1. En arbejder kan altså sætte sig selv i 3 forskellige grupper. Som herover har jeg 2 andre forspørgsler som tæller antallet i kategori2 og kategori3.
Mit problem er, at nu vil jeg gerne lave en forspørgsel som tæller antallet af arbejdere i en gruppe i kategori1+kategori2+kategori3.
Altså et join mellem de 3 forspørgsler. Håber I kan hjælpe.
Well no, I got a lot which are open because noone has answered the question. If the question isn't answered what is the point of closing it. Someday maybe someone will answer and others can find em, and get some help.
I got about 2 with answered which aren't closed, and that's because the answers didn't work / didn't help.
If the questions dont get answerd in a period of time then when you close it you get your point back! Some of them are from last year, so I very much doubt anyone is going to see them, and if the question is still relevant then you could palce a new one which will get more notice. The reason why I mention this is becuase too many people get the help they want and then do not close the question. And I know for sure that in this category people arent very willing to help.
Anway, on to your question, I'll take the risk :o)
An idea would be to make a UNION query
SELECT * FRom qry1 UNION SELECT * FRom qry2 UNION SELECT * FRom qry3
Then use this in anew query where you can Count and GROUP
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.