Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
nikhilgarg
Specialist II
Specialist II

Error while loading data

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

1 Solution

Accepted Solutions
manideep78
Partner - Specialist
Partner - Specialist

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....;

View solution in original post

7 Replies
PrashantSangle

Hi,

Can you post the error, Which you are getting.

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Not applicable

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

nikhilgarg
Specialist II
Specialist II
Author

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.

nikhilgarg
Specialist II
Specialist II
Author

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.

manideep78
Partner - Specialist
Partner - Specialist

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....;

chrislofthouse
Partner Ambassador
Partner Ambassador

You need add a 'group by clause' at the bottom of your query for the fields you are selecting.

awhitfield
Partner - Champion
Partner - Champion

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