Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v5.2
  HXTT Cobol v2.1
  HXTT DBF v5.2
 
  Buy Now
  Support
  Download
  Document
  FAQ
  HXTT Excel v4.2
  HXTT Paradox v5.2
  HXTT Text(CSV) v5.2
  HXTT XML v1.2
Offshore Outsourcing
Oracle Data Import/Export
DB2 Data Import/Export
Sybase Data Import/Export
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
   
   
   
Hongxin Technology & Trade Ltd. of Xiangtan City (abbr, HXTT)

HXTT DBF
Count distinct
Fernando Hartmann
2008-10-07 12:47:53.0
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.0
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.0
It's ok now, thanks a lot.

Search Key   Search by Last 50 Questions




Google
 

Address: 9 Station Rd., Xiangtan City, Hunan Province, P.R. China
Postcode: 411100
Phone: (86)731-58225727
Fax: (86)731-58225727
Email: webmaster@hxtt.com
Copyright © 1999-2011 Hongxin Technology & Trade Ltd. | All Rights Reserved. | Privacy | Legal | Sitemap