[SQL] Get different sums from the same table in one query

2007-10-08 Thread Dani Castaños
Hi all! I want to put this three queries in only one... Take a look that the only thing that changes is the message_type_id. Any suggestions?? SELECT TO_CHAR( statistics_date, 'DD/MM/') AS date_in, sum(total_num_messages) FROM statistics_daily WHERE

Re: [SQL] Get different sums from the same table in one query

2007-10-08 Thread A. Kretschmer
am Mon, dem 08.10.2007, um 12:49:04 +0200 mailte Dani Castaños folgendes: Hi all! I want to put this three queries in only one... Take a look that the only thing that changes is the message_type_id. Any suggestions?? Yes, no problem, You can use UNION (ALL) for such. Andreas -- Andreas

Re: [SQL] Get different sums from the same table in one query

2007-10-08 Thread Peter Childs
On 08/10/2007, A. Kretschmer [EMAIL PROTECTED] wrote: am Mon, dem 08.10.2007, um 12:49:04 +0200 mailte Dani Castaños folgendes: Hi all! I want to put this three queries in only one... Take a look that the only thing that changes is the message_type_id. Any suggestions?? Yes, no

Re: [SQL] Get different sums from the same table in one query

2007-10-08 Thread Richard Huxton
Dani Castaños wrote: Hi all! I want to put this three queries in only one... Take a look that the only thing that changes is the message_type_id. Any suggestions?? SELECT TO_CHAR( statistics_date, 'DD/MM/') AS date_in, sum(total_num_messages) FROM statistics_daily

Re: [SQL] Get different sums from the same table in one query

2007-10-08 Thread A. Kretschmer
am Mon, dem 08.10.2007, um 12:32:55 +0100 mailte Peter Childs folgendes: On 08/10/2007, A. Kretschmer [EMAIL PROTECTED] wrote: am Mon, dem 08.10.2007, um 12:49:04 +0200 mailte Dani Castaños folgendes: Hi all! I want to put this three queries in only one... Take a

Re: [SQL] UNIQUEness and time interval

2007-10-08 Thread Rodrigo De León
On Oct 4, 4:45 am, Nicolas Boullis [EMAIL PROTECTED] wrote: I'd like to define a table with a name, a start_date and a stop_date columns, with a constraint that ensures that 2 records with ovelapping dates don't share the same name. Is there a way to define such a constraint? CREATE TABLE T(