Re: [sqlite] A question about dates

2009-01-15 Thread Igor Tandetnik
Carlos Suarez 
wrote:
> I need to know how I can sum and count the field assoiated by record
> more especifically this:
>
> I got several tables associated
> ie: client --- buys
>name  idbuy
>idcli idcli
>  date
> and I need to count how many buys got every client

Read about GROUP BY clause in your favorite SQL textbook.

select idcli, name, count(*)
from client join buys on (client.idcli = buys.idcli)
group by idcli;

Igor Tandetnik 



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


Re: [sqlite] A question about dates

2009-01-15 Thread Carlos Suarez
thanks for answers so quickly,

I need to know how I can sum and count the field assoiated by record
more especifically this:

I got several tables associated
ie: client --- buys
name  idbuy  
idcli idcli
  date
and I need to count how many buys got every client but when I put
select
idcli
count(distinct buys.date)
from
client, buys
where
client.idcli=buys.idcli

but it's appear to sum everything and only appear the last record and 
the totaly  of buys
>
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>   

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


Re: [sqlite] A question about dates

2009-01-13 Thread Igor Tandetnik
Carlos Suarez 
wrote:
> I need to know how I can split a date field with a slash in -, being
> straight I need to convert the the date format
> /mm/dd to  -mm-dd

replace('/mm/dd', '/', '-')

http://sqlite.org/lang_corefunc.html

Igor Tandetnik 



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


[sqlite] A question about dates

2009-01-13 Thread Carlos Suarez
Hi,

I need to know how I can split a date field with a slash in -, being 
straight I need to convert the the date format
/mm/dd to  -mm-dd  or  something  alike because flex builder 
date format is with slash but sqlite operation results are return with (-)
 in example:


STRFTIME('%J','2009-02-02') - STRFTIME('%J',(2009/01/01))
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users