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 |
|
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2010-08-02 : 01:21:37
|
| Hi All,I am very new to programming i need help for this.I have fixed select query and it returns some 64 number of rows.ouputresultset:meetingid/namegive,namefamily/date/eventnameselect m.id as meeting_id, r.NameGiven,r.NameFamily,e.* from event ejoin Employee r ON r.id = e.rep_idleft join meeting m on m.event_id = e.idwhere marketingprogram_id in (19,24) and eventstatus_id = 5order by marketingprogram_idI need to get the count of persons atteded with all the above column with some other 2 tables,.1.meeting_invitee 2.meeting_otherattendees based on meeting_id columnCan somebody pls help me for query to that.Thanks,Gangadhar |
|
|
slimt_slimt
Aged Yak Warrior
746 Posts |
Posted - 2010-08-02 : 01:40:58
|
| please post schema for both tables (that is Employee and meeting). |
 |
|
|
gangadhara.ms
Aged Yak Warrior
549 Posts |
Posted - 2010-08-02 : 01:56:10
|
| Hi All,I got some improvement and written query,Again i got stuck here ,,there are 2 queries 1..select a.* ,count(*)as NbrOfAttendees from meeting_invitee bb inner join (select m.id as meeting_id, r.NameGiven,r.NameFamily,e.EventName,e.marketingprogram_id from event ejoin Employee r ON r.id = e.rep_idleft join meeting m on m.event_id = e.idwhere marketingprogram_id in (19,24) and eventstatus_id = 5)a on bb.meeting_id=a.meeting_idgroup by a.meeting_id,NameGiven,NameFamily,EventName,marketingprogram_idorder by marketingprogram_idand 2...select a.*,NbrOfAttendees frommeeting_otherAttendees bb inner join (select m.id as meeting_id, r.NameGiven,r.NameFamily,e.EventName,e.marketingprogram_id from event ejoin Employee r ON r.id = e.rep_idleft join meeting m on m.event_id = e.idwhere marketingprogram_id in (19,24) and eventstatus_id = 5) a on bb.meeting_id=a.meeting_id--group by a.meeting_id,NameGiven,NameFamily,EventName,marketingprogram_idorder by marketingprogram_idFrom the above 2 queries i need to fetch SUM(addition) of NbrOfAttendees if meeting_id exist in both the table ,if not as it is it should come.I need your help pls in this regard, |
 |
|
|
slimt_slimt
Aged Yak Warrior
746 Posts |
Posted - 2010-08-02 : 06:34:38
|
| it's hard to help if one does not know the table schema and some sample data. thank you |
 |
|
|
|
|
|
|
|