我使用两个表格,即上传和位置。我试图在laravel中编写一个原始的sql语句,但不确定它是否正确。我想显示位置表的所有列,其中city =“something”和project_id =“something”.Project_id属于位置表。
$get_all_data = \DB::select('select * from locations where city = ?', [$city],'select * from uploads where project_id=?',[$getProjectId]);
答案 0 :(得分: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子句的连接。请注意上限。