From: Oliver d'Azevedo Cristina <oliveiros.cristina@gmail.com>
To: Russell Keane <Russell.Keane@inps.co.uk>
Cc: Russell Keane <Russell.Keane@inps.co.uk>
Cc: deneroteam@gmail.com <deneroteam@gmail.com>
Cc: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Re: need help
Date: Thu, 21 Feb 2013 22:26:11 +0000
Message-ID: <DBE978E6-5887-4B69-943F-2FD59F018FA0@gmail.com> (raw)
In-Reply-To: <8D0E5D045E36124A8F1DDDB463D548557D1618F461@mxsvr1.is.inps.co.uk>
References: <CACotafd7p+MR6famJHOTLQrCMrYRPRSEP8YrNR6PGQ7jNbgBjA@mail.gmail.com>
<CAAk_w-qkwCtrKP5FH4Xro0=xdKj=LAnBdG4ZaV1s7fd5_eRSRw@mail.gmail.com>
<CACotaffP=gssaBJ6D9zkUb1H5bP5bMJXGwE5iWXJmwQ_AMVCLQ@mail.gmail.com>
<76AB0A60-BB3E-4674-881A-F0DF0ECE7F0B@gmail.com>
<8D0E5D045E36124A8F1DDDB463D548557D1618F45F@mxsvr1.is.inps.co.uk>
<8D0E5D045E36124A8F1DDDB463D548557D1618F461@mxsvr1.is.inps.co.uk>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-sql>
Sorry, why do you need the joins?
Best,
Oliver
Enviado via iPhone
Em 21/02/2013, às 09:28 PM, Russell Keane <Russell.Keane@inps.co.uk> escreveu:
>>> Now I really don't know how to do this.
>>>
>>> can you advise me more ?
>>>
>>>
>>> Thanks,
>>>
>>> Dhaval
>>
>>
>> I think these are the sqls you are looking for:
>>
>> SELECT pm.id as move_id, p.id as product_id, l.id as location_id
>> FROM product_move pm inner join product p on pm.product_id = p.id inner join location l on pm.destination_location = l.id
>> and datetime BETWEEN '2010-1-01' AND '2012-12-31'
>
>
> Sorry, that should have been:
>
> For your 2 examples:
>
> SELECT pm.id as move_id, p.id as product_id, l.id as location_id
> FROM product_move pm inner join product p on pm.product_id = p.id inner join location l on pm.destination_location = l.id
> and datetime < '2012-11-30'
>
> SELECT pm.id as move_id, p.id as product_id, l.id as location_id
> FROM product_move pm inner join product p on pm.product_id = p.id inner join location l on pm.destination_location = l.id
> and datetime < '2012-12-31'
>
> I'm not what the use of the 'from' date is in your examples.
> Do you need to know the final destination of the product in that time period?
> Or every destination location of the product in that time period?
>
> Regards,
>
> Russell Keane
> INPS
>
> Follow us on twitter | visit www.inps.co.uk
>
>
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: oliveiros.cristina@gmail.com, Russell.Keane@inps.co.uk, deneroteam@gmail.com
Subject: Re: need help
In-Reply-To: <DBE978E6-5887-4B69-943F-2FD59F018FA0@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox