Having clause does not work

Hi
I do following on one of our clients dbs:
select s.member_no,s.room_nights
from stay_records s, memberships m          
where s.member_no is not null
and s.member_no=m.membership_card_no
group by s.member_no,s.room_nights
having sum(s.room_nights) >= '2'
I basically want to find all members that have stayed two or more nights, the problem is that the query returns lots of one nighters as well. Have I made a mistake in my query?
I'm absolutely sure that the link between the tables are correct.
Apreciate your help.
/Robert

select s.member_no,sum(s.room_nights) room_nights
from stay_records s, memberships m
where s.member_no is not null
and s.member_no=m.membership_card_no
group by s.member_no
having sum(s.room_nights) >= 2ie. don't group by room_nights, and don't surround the 2 with single-quotes.

Similar Messages

Maybe you are looking for

  • Path and File name of the attachment

    Hello Srm Guys, Where should be the Path and File name of the attachment are stored for a shopping card Item. Thanks Ram

  • MM02: Updating characterstics in PO text and Material description

    Hello Experts, I have a requirement wherein, I have to update the characterstics of a material to the Po text and Material description as soon as they are changed in MM02. At present there is a custom program doing the same,but I need to automate it,

  • Tab Order of POPUPKEY_FROM_LOV doesn't seem to work?

    Hi All, If got a POPUPKEY_FROM_LOV in my PL/SQL Dynamic code as follows: APEX_ITEM.POPUPKEY_FROM_LOV(33,lClient,'CLIENTS',60,100,0,'YES', 500,'tabindex="30" ') but it does not recognize the item in the tab order. Can I do it and if so what am I doing

  • Cancel payment

    Every month for the last 5 months, I have been trying to cancel $13.99 per month on my visa for a subscription that I DON'T HAVE.  I WANT THESE PAYMENTS TO STOP BECAUSE I DO NOT HAVE A SUBSCRIPTION ANY LONGER.  IT ENDED LAST OCTOBER 2011 AND THE PAYM

  • Transports Analysis

    Hello All, I need some help on analyzing the transports. The situation here is that we have say about 500 transports that were imported into test system and took about 24 hrs. Now we want to import those transports into another system but to improve