Skip to main content

MeyeSql

Nested Select MySql Statements

August 11, 2016
|

Hello, today I want to talk about MySQL. This discussion requires some understanding of MySQL. Let’s discuss the optimization of NESTED SELECT statements. Consider this MySQL statement: SELECT name, (SELECT count(carts.product_id) FROM carts WHERE carts.product_id = products.id AND cart.date=’2015-01-01’) as count FROM products; I have a table for orders and carts and I want to find how many […]