>From what you've written, my best guess would be something like, select car.id where car.id in (Select CarOperation.id_car where CarOperation.status='exact') and car.id not in (select CarReservation.id_car where GIVEN_DATE > CarReservation.ariv_date and GIVEN_DATE < CarReservation.dep_date)
That is likely wrong, but something like that is where I would start to try and figure it out. Also, I'm not sure all DB's support sub-selects in their queries. Hope it (kinda) helps! Matt. On 6 March 2010 19:13, Alexis Selves <petr.pej...@gmail.com> wrote: > Hello! > I have four tables: > > Car(id, manufacturer, kind) > CarReservation(id, id_car, dep_date,ariv_date) > CarOperation(id, id_car, id_parking, status...) > Parking(id, street, gps....) > > > Now I need to select cars, which are on exact parking and are not > reserved for given date.. > I am totally hopelles.. > > Please help me. > > Thanks in advance. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.