2016-01-06 41 views
0

我使用两个表格,即上传和位置。我正在尝试在laravel中编写一个原始的sql语句,但不确定它的正确与否。我想要显示位置表的所有列,其中city =“something”和project_id =“something”.Project_id属于位置表。Laravel原始SQL语句嵌套在哪里

$get_all_data = \DB::select('select * from locations where city = ?', [$city],'select * from uploads where project_id=?',[$getProjectId]); 

回答

0
SELECT table1.column, table2.column FROM table WHERE table1.city="something" AND table2.product_id="something" JOIN table2 ON table1.key=table2.key. 

我不会称这是一个嵌套的地方。这只是一个多个where子句的连接。注意上限。