teh
|
Posted: 01/29/2002, 5:40 PM |
|
Count values in a column using Mysql / PHP w Templates
I have a column named CHECKED and there are 4 possible values, complete,
in_ progress, fail and null. I would like to display this in a form similar to a:
SELECT checked ,count (*) from TABLE group by checked;
which would return
Checked count (*)
null 712
complete 5
in progress 50
fail 0
A total of all records would be nice also.
Could anyone one help out this newbie please or point me in the right direction. I have looked at the Books/books and I must be missing something and my head is starting to hurt from pounding it on the wall.
Thanks
TeH
|
|
|
Nicole
|
Posted: 01/30/2002, 1:10 AM |
|
Hello,
use mentioned custom sql for Grid form (add it to Form->Properties->SQL tab).
To display total number of fields use separate Grid form with custom sql like:
select count(*) from Table
Like in BookStore example->Books page->Total and Result form.
|
|
|
Teh
|
Posted: 01/30/2002, 9:23 AM |
|
Thanks for the reply Nicole,
I am able to return the names, fail, complete etc, from the CHECKED column but I would also like to return the count(*) values 715 ,5, 10 etc. in the same grid. That is where Im having trouble. I can’t seem to get that part right.
Teh
|
|
|
Nicole
|
Posted: 01/31/2002, 2:04 AM |
|
Teh,
to display checked field and corresponding count() values create Grid form, enter custom sql query:
SELECT checked, count (*) as values from TABLE group by checked
return to the form and add "checked" and "values" field to the form (as usual click 'Show Fields' icon).
Refer to my previous response to find how to display total number of selected records.
|
|
|
Nicole
|
Posted: 01/31/2002, 2:04 AM |
|
Teh,
to display checked field and corresponding count() values create Grid form, enter custom sql query:
SELECT checked, count (*) as values from TABLE group by checked
return to the form and add "checked" and "values" field to the form (as usual click 'Show Fields' icon).
Refer to my previous response to find how to display total number of selected records.
|
|
|
|