Select::Order

Specify the order of the result. Uses the default ordering specified by the server if not explicit.

Sintaxe

namespace ProtocolLive\PhpLiveDb;

/**

 */
final class Select{
public function Order(
string|UnitEnum|null $Fields
):self;
}
Parameters

$Field - The fields names, separated by a comma. Can be used the keywords "asc" and "desc";

Examples

$consult = $Db->Select('users');
$consult->Order('email');
$consult->Run();
//select * from users order by email
$consult = $Db->Select('users');
$consult->Order('cad_date desc');
$consult->Run();
//select * from users order by cad_date desc
$consult = $Db->Select('users');
$consult->Order(UsersFields::CadDate->value . ' desc');
$consult->Run();
//select * from users order by cad_date desc