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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 need help with sql

Author  Topic 

gotafly
Yak Posting Veteran

54 Posts

Posted - 2007-05-30 : 19:55:26
I have 2 tables:
Group and Member

Group has the following fields:
groupID, groupDesc and accountNo

Member has:
memberID,htmlYes, accountNo

I need to fill a datagrid with all the groups in specific accounts. So lets say I have account 8. I need the counts of all the members that are members with htmlYes of 1 and then members with htmlYes of 0

IN the same record:

so:
GROUP NAME HTML TEXT
group 1 8 6
group 2 200 60
group 3 100 50

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-05-30 : 19:58:24
Can you post some sample data from each table for which you are expecting the output you posted?

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

gotafly
Yak Posting Veteran

54 Posts

Posted - 2007-05-30 : 20:05:13
SELECT groupID, groupDesc, accountNo
FROM group
WHERE (accountNo = 3)
ORDER BY groupID
6 groupaaa 3
7 4444 3

SELECT memberID, htmlYes, accountNo
FROM demomember
WHERE (accountNo = 3)

2 no 3
3 no 3
6 no 3
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-05-30 : 21:49:50
can you post
1. your table structure
2. some sample data from each of the table
3. expected result


KH

Go to Top of Page
   

- Advertisement -