cancel
Showing results for 
Search instead for 
Did you mean: 

Select query gives different result in DB level

Former Member
0 Kudos

HI,

An sql query to get the count of the distinct records gives different output when executed from SAP GUI and from DB(sql server management studio 2008).

SAP GUI :

From SQL command editor ,the follwoing qurey gives the output as "515939"

SELECT count(DISTINCT OBJNR) AS c

FROM COEP

WHERE MANDT = '010' AND OBJNR <> 'NV%'

Sql Server Management Studio :

The below query when executed in sql server management studio 2008,gives the result "497411"

select COUNT(DISTINCT OBJNR) from <SID>.COEP where MANDT= '010' and OBJNR NOT LIKE 'NV%'.

Can anyknow help me to know the reason for this.

Thanks,

Sudhakaran

Accepted Solutions (1)

Accepted Solutions (1)

Reagan
Advisor
Advisor
0 Kudos

Hello

I believe the argument <> means NOT EQUAL to where as in the second query you are using the LIKE operator with NOT.

Regards

RB

Answers (0)