Re: need help

From: Oliver d'Azevedo Cristina <oliveiros(dot)cristina(at)gmail(dot)com>
To: Russell Keane <Russell(dot)Keane(at)inps(dot)co(dot)uk>
Cc: Russell Keane <Russell(dot)Keane(at)inps(dot)co(dot)uk>, "deneroteam(at)gmail(dot)com" <deneroteam(at)gmail(dot)com>, "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: need help
Date: 2013-02-21 22:26:11
Message-ID: DBE978E6-5887-4B69-943F-2FD59F018FA0@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Sorry, why do you need the joins?

Best,
Oliver

Enviado via iPhone

Em 21/02/2013, às 09:28 PM, Russell Keane <Russell(dot)Keane(at)inps(dot)co(dot)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(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Alexander Gataric 2013-02-22 03:28:02 Re: Summing & Grouping in a Hierarchical Structure
Previous Message Russell Keane 2013-02-21 21:28:01 Re: need help