[RESOLVED] Select Count Distinct
Anyone can help me with this code ?!
Code:
Dim cn As New OleDbConnection(Conexiune)
Dim SQLResult As Object
Dim SQL As New OleDbCommand
cn.Open()
SQL.Connection = cn
SQL.CommandText = "SELECT COUNT(DISCTINCT(editura)) FROM lista_carti)"
SQLResult = SQL.ExecuteScalar
Me.lbl_nr_edituri.Text = SQLResult
cn.Close()
I have this error: Syntax error in FROM clause.
Why this is not working with access databases !?
Re: Select Count Distinct
You have one too many closing parenthesis....
it should be
Code:
"SELECT COUNT(DISCTINCT(editura)) FROM lista_carti"
-tg
Re: Select Count Distinct
Thanks alot techgnome...
Now i have this one: Undefined function 'DISTINCT' in expression.
Re: Select Count Distinct
I did it!
Code:
SQL.CommandText = "SELECT COUNT(*) FROM (SELECT DISTINCT editura FROM lista_carti)"
Thanks again for your big help!
Re: Select Count Distinct
Its been years since I did Access, but isn't it DistinctCount? (One word).
In SQL Server 2000, the query would be written:
SQL.CommandText = "SELECT COUNT(DISTINCT editura) FROM lista_carti"
Re: Select Count Distinct
Oh, you did it! I really have to read these eff**g posts before I tap keyboard, innit?:blush:
Re: [RESOLVED] Select Count Distinct
I did it bigMeUp!
I dont think is in one word... i did not find anywhere something like that!
Thanks anyway for your help!
Re: [RESOLVED] Select Count Distinct
Excellent, Alexandru_mbm! As a matter of interest, does
Code:
SQL.CommandText = "SELECT COUNT(DISTINCT editura) FROM lista_carti"
work?