G
Guest
I have a query that poulates a field with the count of child records from
another table. The query works perfectly, but, I can't order it by the count
of the child records.
The query Looks basically like this and works great!
SELECT T1.Name, (SELECT COUNT(table2.tbl1$id) as childRecords from table2
where table2.tbl1$id = T1.ID) as NumberOfChildRecords
FROM Table1 as T1;
Now I need to order it. I've tried:
Order By NumberOfChildRecords
(that results in a prompt for a paramater????)
And
Order By (SELECT COUNT(table2.tbl1$id) as childRecords from table2 where
table2.tbl1$id = T1.ID)
(that results in a syntax error?????)
What do I do here? I'm stumped.
another table. The query works perfectly, but, I can't order it by the count
of the child records.
The query Looks basically like this and works great!
SELECT T1.Name, (SELECT COUNT(table2.tbl1$id) as childRecords from table2
where table2.tbl1$id = T1.ID) as NumberOfChildRecords
FROM Table1 as T1;
Now I need to order it. I've tried:
Order By NumberOfChildRecords
(that results in a prompt for a paramater????)
And
Order By (SELECT COUNT(table2.tbl1$id) as childRecords from table2 where
table2.tbl1$id = T1.ID)
(that results in a syntax error?????)
What do I do here? I'm stumped.