Note count (distinct column1, column2) is invalid.
You could use self join like this:
SELECT count(*) FROM table a FULL JOIN table b ON (a.column1 = b.column1 AND a.column2 = b.column2);
You could use sub query like this:
SELECT count(*) FROM ( SELECT 1 FROM table GROUP BY column1, column 2 ) zz ;
zz is the alias for sub-SELECT
You could use || like this:
SELECT count(distinct column1||'%'||column2 ) FROM table;
Maybe should use " instead of ' in some machine. And you also could use other words other than % to avoid mistakes.
Wednesday, December 5, 2007
How to select count distinct number of two columns in SQL?
Tuesday, December 4, 2007
Be indexed by Google
Home page crawl:
Googlebot last successfully accessed your home page on Dec 2, 2007.
Also registered Google Analytics for this blog, Currently:
0 Visits
0 Pageviews
:-(
Also registered Google Analytics for this blog, Currently:
0 Visits
0 Pageviews
:-(
Sunday, December 2, 2007
Saturday, December 1, 2007
How to get program's directory in python?
import os
path = os.path.dirname(__file__) to get the path of .py file.
os.path.dirname returns the directory component of a pathname, __file__ is the full path of .py file.
os.path is a useful module, see the doc:
http://docs.python.org/lib/module-os.path.html
发表者
fairfox
位置在:
11:21 PM
0
评论
标签: programming, python
Subscribe to:
Comments (Atom)