Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with other Select-SQL
Message
 
To
05/04/2001 21:46:19
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00492641
Message ID:
00492673
Views:
19
Martin,

You need to use the DISTINCT part of the COUNT clause:
select field1 as site, count(distinct field2) ;
  from testselect ;
  group by site
Also, my understanding is that the GROUP BY clause in VFP's version of SQL works on the result set, not the input set. This means that you'll need to GROUP BY SITE, rather than field1. Alternatively you could just refer to the field's ordinal position - e.g. GROUP BY 1

Cheers,

Andrew

>Hi guys!
>
>I have a table with the next rows:
>
>field1 field2
>Site A Cell 101
>Site A Cell 101
>Site A Cell 102
>Site A Cell 102
>Site A Cell 103
>Site A Cell 104
>Site B Cell 201
>Site B Cell 201
>Site B Cell 205
>
>
>well, I am locking for sql statment that produces the next dataset result:
>Site Cells_Working
>Site A 4
>Site B 2
>
>I'am trying with :
>Select field1 as site,count(field2) as Cells_working from mytable group by; field1
>but it doesn´t work
>Thanks in advance
>martin Alcaraz
>malcaraz@rtn.uson.mx


If we were to introduce Visual FoxBase+, would we be able to work from the dotNet Prompt?


From Top 22 Developer Responses to defects in Software
2. "It’s not a bug, it’s a feature."
1. "I thought I fixed that."


All my FoxTalk and other articles are available on my web site.


Unless specifically identified otherwise, anthing posted here is purely my opinion and may or may not reflect the policies or practices of Microsoft.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform