添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
谦虚好学的石榴  ·  如何在docker ...·  3 月前    · 
玩命的馒头  ·  DescribeAuditLogRecord ...·  5 月前    · 
聪明伶俐的勺子  ·  install gcc 4.3 on ...·  1 年前    · 

Try this:

// Start query...
$query->orderByRaw("FIELD(priority, 'High', 'Medium', 'Low')");

This works...however a strange error..below is the output

Output: Medium High <----------this one should go up with the High groups

stidges said:

That's strange.. Are you sure that last 'High' doesn't contain extra spacing or anything?

Ohh..just found out..it doesn't work..there is no ordering happening itself

this is my code: finding()->select('vulnerability','impact','risk_rating')->orderByRaw("FIELD('risk_rating', 'High', 'Medium', 'Low')")->get()

stidges said:

Try removing the select:

finding()->orderByRaw("FIELD('risk_rating', 'High', 'Medium', 'Low')")->get(array('vulnerability','impact','risk_rating'));

No..still the same.<br/>

$project->finding()->orderByRaw("FIELD('risk_rating', 'High', 'Medium', 'Low')")->get(array('vulnerability','impact','risk_rating'))

stidges said:

Sorry, I did an edit later. It's the quoting of risk_rating that is the problem, it will interpret it as a string instead of the column name. Try removing it or quoting it with back quotes

Yo \m/ thanks man..works like charm

Here's the code: $project->inding()->select('vulnerability','impact','risk_rating')->orderByRaw("FIELD(risk_rating, "High", "Medium", "Low")")->get()