select sum

  • Thread starter Thread starter Ghena
  • Start date Start date
G

Ghena

Hi to everybody.
I need a query able to display only the records that summed are > or =
(parameter)


FOR EXAMPLE

FIND AND DISPLAY ALL THE RECORDS THAT SUM OF MAX_PAX ARE >= 7
=========================
MAX_PAX ID
3 1
2 2
1 3
=========================

IN THIS WAY IT'DOESNT WORKS AS I WOULD :

SELECT table1.max_pax AS TOT2
FROM [SELECT sistemazioni_base.max_pax, sistemazioni_base.id,
sistemazioni_base.id_strut
FROM sistemazioni_base
GROUP BY sistemazioni_base.max_pax, sistemazioni_base.id,
sistemazioni_base.id_strut
HAVING (((sistemazioni_base.id_strut)=11));]. AS table1
GROUP BY table1.max_pax
HAVING (((table1.max_pax)>7));
 
Let us take this a little bit at a time. What are you summing? Are you
summing the maximum of each different PAX? Are you looking for maximum of a
PAX that is equal to or greater than seven?

Give an example of your raw data. The data you posted has no record that is
equal or greater than seven.

Give an example of what you expect the results of the query to look like for
that same data.
 
This is my table
=========================
MAX_PAX ID tipo_room
3 1 tpl
2 2 dbl
1 3 sgl
=========================

FIND AND DISPLAY JUST THE RECORDS IN WICH SUM(MAX_PAX) IS EQUAL TO 5


RESULTS:

==================
MAX_PAX ID tipo_room
3 1 tpl
2 2 dbl

Another example:

FIND AND DISPLAY JUST THE RECORDS IN WICH SUM(MAX_PAX) IS EQUAL TO 4
results:

=========================
MAX_PAX ID tipo_room
3 1 tpl
1 3 sgl
=========================

I hope it is more clear.
bye!
 
Back
Top