[ic] sql funtion (group by and count)
Stefan Hornburg
interchange-users@icdevgroup.org
Tue May 6 16:39:00 2003
On Tue, 6 May 2003 22:08:48 +0200
"Xavier GILLET" <xavier.gillet.perso@wanadoo.fr> wrote:
> hi,
>
> Does anyone know how to use group by and count mysql functions in IC ?
> This request groups column 'departement' and display the list, but
> does not count the number of entries for each 'departement'.
>
> [query sql="select departement, count(departement) from [scratch
> this_page]
> where
> initial_status = 'confirmee'
> and
> actual_status = 'En ligne'
> and
> sens = 'Vente'
> group by departement"
> type=list]
> [list]
> [sql-param departement]<br>
> [/list]
> [/query]
The [query] tag groks any valid SQL statement if the underlying database
is native SQL, but you might need to use [sql-pos] resp. [PREFIX-pos]
to learn the results of it. In your example [sql-pos 1] would display
the count.
Bye
Racke
--
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team