Nubcoder32
Доброго времени суток. Нужно добавить условие (если) в SQL запрос
Код (Text):
«SELECT shopping_cart.*, product.*, product_variations.* FROM shopping_cart LEFT JOIN product ON product.product_id = shopping_cart.cart_productId IF(shopping_cart.cart_variationId != NULL){ LEFT JOIN product_variations ON product_variations.product_id = shopping_cart.cart_productId } «Собственно вот участок
Код (Text):
IF(shopping_cart.cart_variationId != NULL){ LEFT JOIN product_variations ON product_variations.product_id = shopping_cart.cart_productId }Где нужно выполнить
Код (Text):
LEFT JOIN product_variations ON product_variations.product_id = shopping_cart.cart_productIdТолько если shopping_cart.cart_variationId не NULL
MouseZver
LEFT JOIN product_variations ON product_variations.product_id = shopping_cart.cart_productId AND shopping_cart.cart_variationId IS NOT NULL
Nubcoder32
Тянет пустые значения(
Drunkenmunky
NULL и » не то же самое