March 17, 2012 at 7:32 am
for example iam having a table with 3 rows and 3 column
like this 1,1 1,2 1,3
2,1 2,2 2,3
3,1 3,2 3,2
from this table if the member is selecting two space (2,2 2,3 3,2 3,3)
it will be insert in the table as like this
spid memberid row column
1 1 2 2
2 1 2 3
3 1 3 2
4 1 3 3
if i need know no of blocks owned by member means
i can easily do
select count(row) from sp table where memberid=1
it will find total block 4
but i need how many no of column the member owned
and how many no of row the member owned
some one said just pick the maximum value
of row and subtract that
how can i find no of row not count of row
and no of column
March 17, 2012 at 1:46 pm
Having a bit of a problem with the broken English but I believe this might be what you're looking for.
SELECT MemberID,
RowsOwned = COUNT(DISTINCT [Row]),
ColsOwned = COUNT(DISTINCT [Column])
FROM dbo.yourtable
GROUP BY MemberID
;
--Jeff Moden
Change is inevitable... Change for the better is not.
March 17, 2012 at 2:50 pm
Is this still the same issue as the one you posted a few days ago?
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply