Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 generating each row of a duplicate

Author  Topic 

tariq2
Posting Yak Master

125 Posts

Posted - 2011-10-19 : 07:54:36
Hello and thank you in advance for your assistance :)
Below I have a sub-query which generates duplicates of one
combination.I want to now generate each row but cant quite achieve this.
Am receiving the following:
Msg 4145, Level 15, State 1, Line 2
An expression of non-boolean type specified in a context where a condition is expected, near ','.



select * from View_F_ICTrans
where gldoc,gljeln,glmcu,globj,LEID,PeriodID in

(
select gldoc,gljeln,glmcu,globj,LEID,PeriodID
--COUNT(gldoc) as Occ
from View_F_ICTrans
WHERE LEID = '01002'
group by gldoc,gljeln,glmcu,globj,LEID,PeriodID

having COUNT(gldoc) >1
--ORDER BY GLDOC
)

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2011-10-19 : 08:07:38
Your syntax isn't in the first where-statement is wrong, you can't list columns like that. Each where condition must be "fully qualified" (in lack of a better word) and multiple where conditions are added with AND or OR operators like this

...
where col1 = x and col2 = y and (col3 = 1 or col4 = 1)

Now I'm not really sure what you are trying to do with the query you have here...can you please elaborate a bit more?


- Lumbago
My blog-> http://thefirstsql.com/2011/07/08/how-to-find-gaps-in-identity-columns-at-the-speed-of-light/
Go to Top of Page

tariq2
Posting Yak Master

125 Posts

Posted - 2011-10-19 : 08:14:21
Hi, thank you for getting back to me

select gldoc,gljeln,glmcu,globj,LEID,PeriodID
--COUNT(gldoc) as Occ
......................

generates the rows with duplicates..

I now need to see each and every row.

I hope this is clearer
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-19 : 08:19:40
quote:
Originally posted by tariq2

Hi, thank you for getting back to me

select gldoc,gljeln,glmcu,globj,LEID,PeriodID
--COUNT(gldoc) as Occ
......................

generates the rows with duplicates..

I now need to see each and every row.

I hope this is clearer



nope...not at all
post some sample data and explain what you want

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -