Last active
August 16, 2018 12:48
-
-
Save sufian07/1dca8258de8b301fef62c6809882c785 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| sprintf( | |
| 'SELECT * FROM (%s)', | |
| implode( | |
| ' INNER JOIN ', | |
| array_map( | |
| function($s,$i){ | |
| return sprintf( | |
| "(%s) as temp%d %s", | |
| $s, | |
| $i, | |
| ($i > 0)?" USING (workorder_id) ":'' | |
| ); | |
| }, | |
| $subqueries, | |
| array_keys($subqueries) | |
| ) | |
| ) | |
| ); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
useful when you have an array of sub queries need to
INNER JOIN