Reply
Old 09-04-2006, 05:26 PM Sql Help
Novice Talker

Posts: 7
Trades: 0
Hi Everyone,

I have a question regarding a SQL Query. I am new to Sql programming.

my query is:
SELECT
M.MeetingCode,
M.City AS MeetingCity,
M.State AS MeetingState,
Count(*) as NoofRSVP
FROM
Programs P
INNER JOIN eCDReservations M ON (P.SubCompanyCode = M.SubCompanyCode AND P.ProgramCode = M.ProgramCode)
LEFT JOIN MeetingAttendees MA ON (M.ReservationID = MA.MeetingID)
INNER JOIN Attendees A ON (MA.AttendeeID = A.AttendeeID)

WHERE
P.SubCompanyCode = 'A011' AND
P.ProgramCode = 'ACL52B'

GROUP BY
M.MeetingCode,
M.City,
M.State

if I run it i get 2 rows.

But if run following query:

SELECT
M.MeetingCode,
M.City AS MeetingCity

from
Programs P, eCDReservations M
WHERE
P.SubCompanyCode = M.SubCompanyCode AND
P.ProgramCode = M.ProgramCode AND
P.SubCompanyCode = 'A011' AND
P.ProgramCode = 'ACL52B'
order by
M.City,
M.State

I get 4 rows. I want all these 4 rows appear in first query result with NoofRSVP = either 0 or null if there is no matching MeetingID in MeetingAttendees table.
neha101 is offline
Reply With Quote
View Public Profile
 
 
When You Register, These Ads Go Away!
Old 09-08-2006, 06:44 AM Re: Sql Help
jito's Avatar
MY LIFE IS 'i' LIFE

Posts: 565
Name: surajit ray
Location: inside the heart of my friends
Trades: 0
tell in simple english your problem and tell us ur table structure
__________________
I am not smart, that's why i don't act smart
jito is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Sql Help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.08549 seconds with 13 queries