2017-11-18 44 views
0

林試圖查詢與列的表中調用完成和列稱爲follow_ups其他列中 - 使用laravel IM使用laravel模型試圖MySQL的SELECT * FROM表,其中列中的值=列b值laravel

select * from table where completed > follow_ups 
select * from table where completed = follow_ups 

IM運行以下

$followUps = TestFollowups::where('follow_ups', '>', 'completed')->get(); 

我沒有使用laravels模型系統,我可以寫一本手冊查詢,以及,但不確定查詢應該是什麼樣子。任何人都可以幫助請

+2

https://stackoverflow.com/questions/30331437/laravel-eloquent-compare-column-values –

+0

謝謝這正是我需要的 – Yeak

回答

0

您可以使用:

whereRaw(select * from table where completed > follow_ups) 
相關問題