Created
September 12, 2019 15:17
-
-
Save mnvx/b24ac480be377b106b4e8538a27ba0ae to your computer and use it in GitHub Desktop.
test query
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 | |
$pdo = new \PDO('pgsql:host=localhost;dbname=postgres', 'postgres', 'postgres'); | |
$sql = <<<SQL | |
SELECT * | |
FROM ( | |
SELECT 'CHAC TECHNOLOG*' as alias | |
UNION | |
SELECT 'KINDERY LIGHTING SALES DE?T*' | |
) m | |
JOIN ( | |
SELECT 'CHACTECHNOLOGICO' as ie_clean | |
UNION | |
SELECT 'KINDERYLIGHTINGSALESDEPT' as ie_clean | |
) t ON t.ie_clean ILIKE REPLACE(REPLACE(REPLACE(m.alias, '*', '%'), '?', '_'), ' ', '') | |
ORDER BY ie_clean; | |
SQL; | |
echo $sql . PHP_EOL . PHP_EOL; | |
$stmt = $pdo->query($sql); | |
//$pdo->setAttribute(\PDO::ATTR_EMULATE_PREPARES, true); | |
print_r($stmt->fetchAll(\PDO::FETCH_ASSOC)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment