Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am writting following script but it is giving me error:
Oledb Connection....
Table1:
SQL Select * , count(uid) as Col1 From [db1],[dbo].[tablename] With (NOLOCK) where servicename = 'abc' and username = 'def' ;
THankx
Hi Nikhil,
You are using the aggregation function along with other columns(here the other columns are all columns that are represented by *). so include all other columns in group by clause.
SQL Select * , count(uid) as Col1 From [db1],[dbo].[tablename] With (NOLOCK) where servicename = 'abc' and username = 'def'
group by col1, col2....;
Hi,
Can you post the error, Which you are getting.
Regards
Hi Nikhil,
You didn't mention what kind of error your getting.
Please see the common Error and it codes..
ERROR CODE -
0 -No Error
1 -General Error
2 -Syntax Error
3 & 4 -ODBC/OLEDB Error
8 - File Not Found Error
It is giving error:
'db1.dbo.tablename.servicename'is invalid in select list becoz it is not contained in either an aggregate fn or group by clause.
It is giving error:
'db1.dbo.tablename.servicename'is invalid in select list becoz it is not contained in either an aggregate fn or group by clause.
Hi Nikhil,
You are using the aggregation function along with other columns(here the other columns are all columns that are represented by *). so include all other columns in group by clause.
SQL Select * , count(uid) as Col1 From [db1],[dbo].[tablename] With (NOLOCK) where servicename = 'abc' and username = 'def'
group by col1, col2....;
You need add a 'group by clause' at the bottom of your query for the fields you are selecting.
As you are select * , you need to add all other columns being select in a group by clause, you would much better off selecting the actual columns you want and group by those and NOT using *
This is an SQL error , not a Qlikview one.
Andy