I am using php with pdo to query a database in postgress
.
Is there any way that when I do query
, show the result without having to insert the table name, since the select is unique?
select distinct a as origem
from b union select distinct as dest form b
php
for ($x = 0; $x < $stmt->rowCount(); $x++) {
$n[] = $stmt->fetch(PDO::FETCH_ASSOC);
}
This way if you put the table name, I know that if you do $row['origem']
it works but there may be dest
too.