Re: [SQL] need help

2013-02-22 Thread denero team
Hey, Thanks Russell and all others. The query worked well. I got result what I expected. Thanks again, Dhaval On Fri, Feb 22, 2013 at 4:11 PM, denero team wrote: > Thanks Russell, > > let me check the query. > > On Fri, Feb 22, 2013 at 2:56 PM, Russell Keane > w

Re: [SQL] need help

2013-02-22 Thread denero team
Thanks Russell, let me check the query. On Fri, Feb 22, 2013 at 2:56 PM, Russell Keane wrote: >> Or every destination location of the product in that time period? > > Ok, I've had another look at this this morning on the assumption you need > every location that a product has been in that time

Re: [SQL] need help

2013-02-21 Thread denero team
location l > INNER JOIN product_move m ON m.source_location = location.id > INNER JOIN product p ON m.product_id = p.id > WHERE p.id = $product_id > AND m.datetime < $given_date > ORDER BY datetime DESC LIMIT 1 > > It will return the name of the product and the location for a g

[SQL] need help

2013-02-21 Thread denero team
Hi All, I need some help for my problem. Problem : I have following tables 1. Location : id, name, code 2. Product id, name, code, location ( ref to location table) 2. Product_Move id, product_id ( ref to product table), source_location (ref to location table) , destination_location (