Skip to content

Conversation

@phpseven
Copy link

@phpseven phpseven commented Aug 16, 2021

before: when we use where RAW on SQL_FUNCTION(col_name), we must write whole condition in ONE RAW SQL,
now : You can write one condition in ONE RAW,

In other words, as long as there is an SQL method, all limit, order and group by must be written together. Not elegant

也就是说,之前只要带有一个sql的方法,那所有的LIMIT,ORDER,GROUP BY就都必须写在一起了,很难看

$data = $database->select('account', [
'user_id',
'email'
],
Medoo::raw('WHERE
LENGTH(<user_name>) > 5
ORDER BY RAND()
LIMIT 10
')
);

now you can write it like

$this->database->select(
"account",
"user_name",
[
Medoo::raw("ROUND(<float_val>) = :round_value", [':round_value'=>10]),
'LIMIT' => [20, 100],
"ORDER" => "user_id",
]
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant