Re: need help

Поиск
Список
Период
Сортировка
От Russell Keane
Тема Re: need help
Дата
Msg-id 8D0E5D045E36124A8F1DDDB463D548557D1618F461@mxsvr1.is.inps.co.uk
обсуждение исходный текст
Ответ на Re: need help  (Russell Keane <Russell.Keane@inps.co.uk>)
Ответы Re: need help  (Oliver d'Azevedo Cristina <oliveiros.cristina@gmail.com>)
Список pgsql-sql
> > 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

В списке pgsql-sql по дате отправления:

Предыдущее
От: Russell Keane
Дата:
Сообщение: Re: need help
Следующее
От: Oliver d'Azevedo Cristina
Дата:
Сообщение: Re: need help