April 28, 2011 at 12:50 pm
iam having table like below
VID Compnayid Dataitemid Value PEO
747298 21171 21634 0 2203
429784349 21171 21634 0 2203
429807485 21171 21634 0 2203
440129783 21171 21634 0 2203
450206461 21171 21634 0 2203
454391415 21171 21634 0 2203
747298 21171 21636 0 2203
429784349 21171 21636 0 2203
429807485 21171 21636 0 2203
440129783 21171 21636 0 2203
450206461 21171 21636 0 2203
454391415 21171 21636 0 2203
by using abiove table i need results like below(count of verions) can any one help me on this
Compnayid Dataitemid PEO Count of vid
21171 21636 2203 6
21171 21634 2203 6
i am using SQL server 2003 so can i get a code for it
i used below one but it is displaying like below instead of 6 iam getting 1
21634 21171 2203 1
21636 21171 2203 1
select dataitemid,companyId,estimateperiodid, count(prasad)from #prasad_tbl
group by companyId,dataitemid,estimateperiodid,prasad
April 28, 2011 at 12:55 pm
Please don't create new threads for new answers to your existing question. It just fragments the answers.
Reply to the original post here
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply