Good afternoon, I just noticed. If I write a mysql query with a JOIN in it, for example:
Select Car, Vendor from Cars JOIN Vendor On Vendor.IdCar=Car.IdCar WHERE Car="Brand"
He will return that car, which is equal to the "Brand".
But I noticed that if I structure the request this way:
Select Car, Vendor from Cars JOIN Vendor On Vendor.IdCar=Car.IdCar AND Car="Brand"
It will return the same as the previous request. Noticed that I used AND instead of WHERE. I also tested the PHP queries I worked with. For example:
Select Car, Vendor from Cars JOIN Vendor On Vendor.IdCar=Car.IdCar AND Car=$brand
instead
Select Car, Vendor from Cars JOIN Vendor On Vendor.IdCar=Car.IdCar WHERE Car=$brand
So, the question I ask is this: why does the second query work? This is because JOIN was used because I was sure the WHERE clause was necessary before AND?
source
share