Board index » delphi » "SQL script"

"SQL script"

Hello
This is OK:
select count(*) from DATABASE where DATA2='xxxx'
and this:
select DATA1, DATA2 from DATABASE where DATA2='xxxx'
but this not work:
select count(*),DATA1,DATA2 from DATABASE where DATA2='xxxx'

How I can get "row DATA" and "row count" where DATA2='xxxx'?

 

Re:"SQL script"


You need to use Group By.

select DATA1, DATA2, count(*) from DATABASE where DATA2='xxxx'
group by DATA1, DATA2

Regards,
Andy Mackie

Quote
<jude .> wrote in message news:3bdf84dd$1_1@dnews...

> Hello
> This is OK:
> select count(*) from DATABASE where DATA2='xxxx'
> and this:
> select DATA1, DATA2 from DATABASE where DATA2='xxxx'
> but this not work:
> select count(*),DATA1,DATA2 from DATABASE where DATA2='xxxx'

> How I can get "row DATA" and "row count" where DATA2='xxxx'?

Other Threads