Jump to content

MySQL search across multiple tables


zero_ZX

Recommended Posts

Hi,

So I'm trying to make a car rental project, and I need to show cars of a specific type, available in a specific period.

I'm currently using this query:

SELECT * FROM car, reservations

WHERE car.car_id = reservations.car

AND car.type = 1 AND reservations.reserved_from >= "2011-12-22"

AND reservations.reserved_to <= "2012-12-20";

 

So this returns all the cars of the type 1 reserved in 2011-12-22 - 2012-12-20 period.

So know that I know which cars are unavailable, how would you go ahead and pick out what's left? :)

Link to comment
https://forums.phpfreaks.com/topic/252735-mysql-search-across-multiple-tables/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.