Select::Fields
Specify the table fields to return Sintaxe
namespace
ProtocolLive\PhpLiveDb;
final class Select{
public function
Fields(
}
string|UnitEnum|string[]|UnitEnum[]
$Fields
):self;
Parameters
$Field - The fields names, subquerys or sql functions; Examples Many fields as string
$consult
=
$Db->Select('users');
Many fields as array
$consult->Fields('user_id,name,email,active,lastlogin'); $consult->Run(); //select user_id,name,email,active,lastlogin from users
$consult
=
$Db->Select('users');
Subquery as string
$consult->Fields(['user_id', 'name', 'email', 'active', 'lastlogin']); $consult->Run(); //select user_id,name,email,active,lastlogin from users
$consult
=
$Db->Select('users u');
Subquery as array
Fields as enum
$consult->Fields('
user_id,(
');
select value from socialmedias where name='Telegram' and user_id=u.user_id
) as telegram
$consult->Run(); //select user_id,(select value from socialmedias where name='Telegram' and user_id=u.user_id) as telegram from users u |
*/