Chodzi mi o coś takiego - według manuala pear::Db kod
<?php
// Once you have a valid MDB2 object named $mdb2...
$table_name = 'user';
// if left as a non array all fields of the table will be fetched using '*'
// in that case this variable can be set to true, to autodiscover the types
'name' => 'text',
'country' => 'text'
);
$mdb2->loadModule('Extended');
$res = $mdb2->extended->autoExecute($table_name, null,
MDB2_AUTOQUERY_SELECT, 'id = '.$mdb2->quote(1, 'integer'),
null, true, $result_types);
if (PEAR::isError($res)) {
}
$row = $res->fetchRow();
?>
stworzy
SELECT name, country FROM user WHERE id = 1
Tylko jak i czym stworzyć
SELECT user.name, user.country, COUNT(comment.id) AS comment_count FROM user LEFT JOIN comment ON comment.user_id=user.id WHERE user.id=1 GROUP BY user.id
?