First page Back Continue Last page Image

Basic IF Statement Example

SELECT vendor_name,

IF(vendor_city = 'Fresno', 'Yes', 'No')

AS fresno

FROM vendors

Keep in mind that what is in the red here does not have to be static, I could have vendor_city being compared to another field (perhaps in another table)

Even the green parts here could be unique database queries