Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v7.1
  HXTT Cobol v5.0
  HXTT DBF v7.1
 
  Buy Now
  Support
  Download
  Document
  FAQ
  HXTT Excel v6.1
  HXTT Json v1.0
  HXTT Paradox v7.1
  HXTT PDF v2.0
  HXTT Text(CSV) v7.1
  HXTT Word v1.1
  HXTT XML v4.0
Offshore Outsourcing
Free Resources
  Firewall Tunneling
  Search Indexing Robot
  Conditional Compilation
  Password Recovery for MS Access
  Password Recovery for Corel Paradox
  Checksum Tool for MD5
  Character Set Converter
  Pyramid - Poker of ZYH
   
   
   
Heng Xing Tian Tai Lab of Xi'an City (abbr, HXTT)

HXTT DBF
Count distinct
Fernando Hartmann
2008-10-07 12:47:53
In hour application we have on query like this in PostGreSQL

select count(distinct vendor), count(customer) from table

This query counts the number of unique vendors and count the total number of customers, in my sample table it returns :

vendor customer
------- ---------
7 2814

It is the response that I need.

Now using the same date in a DBF table, I made the following tests...

This same query running in VFP 9.0 generate the same response that PostGreSQL

vendor customer
------- ---------
7 2814

With HXTT , I found a thread in the forum that says to use Distinct on ( Cont distinct do not work) , the I created the following related query

select distinct on (vendor) , count(vendor) , count(customer) from table

And it returns

vendor customer
------- ---------
6 7

How can I wrote a query to obtain the "correct" answer with HXTT ?

Thanks for your support.
Re:Count distinct
HXTT Support
2008-10-08 23:39:06
According to your request, v4.2.005 supports DISTINCT parameter for the aggregate functions of COUNT, SUM, and AVG. You can use the following sqls:
select (select distinct on (vendor) count(vendor) from table1), (select count(customer) from table1)
select count(*),sum(atempcolumn) from (select count(customer) as atempcolumn from table1 group by vendor)
select count(distinct vendor), count(customer) from table1
Re:Re:Count distinct
Fernando Hartmann
2008-10-09 08:05:19
It's ok now, thanks a lot.

Search Key   Search by Last 50 Questions




Google
 

Email: webmaster@hxtt.com
Copyright © 2003-2019 Heng Xing Tian Tai Lab of Xi'an City. | All Rights Reserved. | Privacy | Legal | Sitemap