Thanks a lot, Sam (and others), thanks to your help I managed to finally
produce the query I wanted.
Regards,
mk
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
On Thu, Apr 09, 2009 at 08:16:55PM +0200, Marcin Krol wrote:
> Sam Mason wrote:
> >On Thu, Apr 09, 2009 at 07:25:42PM +0200, Marcin Krol wrote:
> >>SELECT h.id, r.id, r.start_date, r.end_date
> >> FROM hosts h
> >>LEFT JOIN (reservation_hosts m INNER JOIN reservation r
> >>ON m.reserva
Hi,
Do you need a MIN(start_date) for each host you get from the query
before last join?
Yes, I really do - the idea is that from several reservations fulfilling
the dates condition the earliest reservation has to be selected (i.e.
the one with minimum start date).
I edited your code sligh
Sam Mason wrote:
On Thu, Apr 09, 2009 at 07:25:42PM +0200, Marcin Krol wrote:
Sam Mason wrote:
This is a big hint that things are going wrong. You need those quotes
in there, an "integer" is a plain number and not a date.
This one does work in the sense of selecting out the wrong host but it
e responsabilité
pour le contenu fourni.
> Date: Thu, 9 Apr 2009 18:08:04 +0200
> From: mrk...@gmail.com
> To: s...@samason.me.uk
> CC: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] complicated query (newbie..)
>
> Sam Mason wrote:
> > On Thu, Apr 09, 2009 a
On Thu, Apr 09, 2009 at 07:25:42PM +0200, Marcin Krol wrote:
> Sam Mason wrote:
> >This is a big hint that things are going wrong. You need those quotes
> >in there, an "integer" is a plain number and not a date.
>
> This one does work in the sense of selecting out the wrong host but it
> still
ponsabilité
pour le contenu fourni.
> Date: Thu, 9 Apr 2009 18:08:04 +0200
> From: mrk...@gmail.com
> To: s...@samason.me.uk
> CC: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] complicated query (newbie..)
>
> Sam Mason wrote:
> > On Thu, Apr 09, 2009 at 04:47:32PM
Sam Mason wrote:
This is a big hint that things are going wrong. You need those quotes
in there, an "integer" is a plain number and not a date.
This one does work in the sense of selecting out the wrong host but it
still produces nothing but NULLs!
SELECT h.id, r.id, r.start_date, r.end_da
On Thu, Apr 09, 2009 at 07:03:55PM +0200, Marcin Krol wrote:
> - If I quote date values like '2009-04-09' it doesn't work again! I.e.
> result set includes one host id that should have been excluded (bc it
> has reservation whose date doesn't match the condition)
You *need* those quotes in there
On 09/04/2009 18:03, Marcin Krol wrote:
> - If I quote date values like '2009-04-09' it doesn't work again! I.e.
> result set includes one host id that should have been excluded (bc it
> has reservation whose date doesn't match the condition)
>
> - I have replaced OVERLAPS with explicit date condi
Hello Sam,
Thanks a million for reply! I'm so frustrated with this..
Sam Mason wrote:
On Thu, Apr 09, 2009 at 06:08:04PM +0200, Marcin Krol wrote:
What I'm trying to accomplish is producing list of hosts available
within a specified timeframe.
What I have is a table of hosts, table of reserv
On Thu, Apr 09, 2009 at 06:08:04PM +0200, Marcin Krol wrote:
> What I'm trying to accomplish is producing list of hosts available
> within a specified timeframe.
>
> What I have is a table of hosts, table of reservations (containing id,
> start_date and end_date) and an association table reserva
Sam Mason wrote:
On Thu, Apr 09, 2009 at 04:47:32PM +0200, Marcin Krol wrote:
I've got 3 tables: hosts (with host.id column) and reservation (with
reservation.id column) in many-to-many relation, and reservation_hosts
which is an association table (with reservation_id and host_id columns).
So
On Thu, Apr 09, 2009 at 04:47:32PM +0200, Marcin Krol wrote:
> I've got 3 tables: hosts (with host.id column) and reservation (with
> reservation.id column) in many-to-many relation, and reservation_hosts
> which is an association table (with reservation_id and host_id columns).
>
> So I've got
Hello Aurimas,
Thanks for answer!
Do you need a MIN(start_date) for each host you get from the query
before last join?
Yes, I really do - the idea is that from several reservations fulfilling
the dates condition the earliest reservation has to be selected (i.e.
the one with minimum start da
Hi,
I've got 3 tables: hosts (with host.id column) and reservation (with
reservation.id column) in many-to-many relation, and reservation_hosts
which is an association table (with reservation_id and host_id columns).
So I've got this query which selects hosts and reservations under
certain cond
16 matches
Mail list logo