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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COUNT TROUBLES

Status
Not open for further replies.

pondi

Programmer
Jun 6, 2001
32
GB
Hi all,
This is my table (simplificated)
cr1 cr2
elt1 2 3
elt2 5 5
elt3 7 4
elt4 9 1
...
For each criteria (cr) I have a constant gate, and i'd like to count the number of elements exceeding the 2 gates, the number over one and not the other and finally the number under these gates.
In fact my application is graphical, each point or element is placed on the graphical with cr1 against cr2, and I'd like to count the number of points in each part of the graphical.
Note: data.typeid are the criteria cr1 & cr2
7 and 10 are my gates.
This is the beginning of my query:
---------------------------------------------------------
SELECT COUNT (*) AS UNSTRUCTURED
FROM data INNER JOIN elements ON data.ownerid=elements.id
WHERE (data.typeid=19 AND data.value>7) AND data.ownerid IN
(SELECT data.ownerid FROM data WHERE (data.typeid=18 AND data.value<=10)
AND elements.typeid=4);
---------------------------------------------------------
Here is one count, I use a UNION to get the 4 numbers but my result is one column and I'd like to catch a row in order to make a graphical analysis with Access.
thanx for your help if you have any idea about catching one row or improving the performance of my query...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top