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.
| 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 2An expression of non-boolean type specified in a context where a condition is expected, near ','.select * from View_F_ICTranswhere gldoc,gljeln,glmcu,globj,LEID,PeriodID in (select gldoc,gljeln,glmcu,globj,LEID,PeriodID--COUNT(gldoc) as Occfrom View_F_ICTransWHERE LEID = '01002'group by gldoc,gljeln,glmcu,globj,LEID,PeriodIDhaving 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?- LumbagoMy blog-> http://thefirstsql.com/2011/07/08/how-to-find-gaps-in-identity-columns-at-the-speed-of-light/ |
 |
|
|
tariq2
Posting Yak Master
125 Posts |
Posted - 2011-10-19 : 08:14:21
|
| Hi, thank you for getting back to meselect 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 |
 |
|
|
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 meselect 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 allpost some sample data and explain what you want------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|