S
Senna
(Access)
Hi,
I have three tables looking something like this:
code:-----------------------------------------------------
CREATE TABLE tabl1
(
t1_id int counter
t1_title varchar
)
CREATE TABLE table2
(
t2_id int counter
t2_t1_id int
t2_title varchar
)
CREATE TABLE table3
(
t3_id int counter
t3_t2_id int
t3_title varchar
)
end code:-------------------------------------------------
What I would like to do is. In one query count how many
t2_id and t3_id(thru table2) that belong to each t1_id.
I have a query that do the first part, counts t2_id, see
below. But I dont know how to get the second count in
there. Help please.
code:-----------------------------------------------------
SELECT t1_id, t1_title, (SELECT COUNT(t2_id) FROM table2
WHERE t2_t1_id = t1_id) as total2 FROM table1
end code:-------------------------------------------------
Hi,
I have three tables looking something like this:
code:-----------------------------------------------------
CREATE TABLE tabl1
(
t1_id int counter
t1_title varchar
)
CREATE TABLE table2
(
t2_id int counter
t2_t1_id int
t2_title varchar
)
CREATE TABLE table3
(
t3_id int counter
t3_t2_id int
t3_title varchar
)
end code:-------------------------------------------------
What I would like to do is. In one query count how many
t2_id and t3_id(thru table2) that belong to each t1_id.
I have a query that do the first part, counts t2_id, see
below. But I dont know how to get the second count in
there. Help please.
code:-----------------------------------------------------
SELECT t1_id, t1_title, (SELECT COUNT(t2_id) FROM table2
WHERE t2_t1_id = t1_id) as total2 FROM table1
end code:-------------------------------------------------