Hi, I'm wondering if breaking up the query into 2 or 3 queries will have any impact on the performance?
Techinically I could combine them into 1 statement but, it makes the query complicated and I suspect mysql is going through the same number of data (since the number of rows and cols in the tables is always the same regardless of the queries made).
To make things clear, heres an example:
//First statement to find a child value and store to a variable
$child = SELECT child FROM parent WHERE child = 1; //syntax is wrong, just for demostration
//THEN you find siblings with that value
$siblings = SELECT silbings FROM children WHERE child = $child
//Combining the statements
$siblings = SELECT silbings FROM children WHERE child = (SELECT child FROM parent WHERE child = 1)
Does the 2nd method performs better? It seems to me both reads the same amount of data.