"Tejas" <[EMAIL PROTECTED]> wrote in
message news:[EMAIL PROTECTED]
> I have a table 'stats' with following schema
> date varchar (25), utilization int, os_name varchar(25) ...
>
> I am recording host utilization for windows and linux operating
> systems (os_names) at various times in a day in this table. The date
> column has a format of yyyy-mm-dd.
>
> I want to do the following:
> 1. select top utilization for each day for all days recorded so far.

select date, max(utilization) group by date;

> 2. display a table with columns: date, utilization_linux,
> utilization_windows from the recorded data.

select date,
    max(case when os_name='linux' then utilization else 0 end) 
utilization_linux,
    max(case when os_name='windows' then utilization else 0 end) 
utilization_windows
group by date;

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to