 |
SQL ครับ SQL และ laravel เกี่ยวกับ Join อยากขอตัวอย่างหรือคอนเสร็ปหน่อยครับ |
|
 |
|
|
 |
 |
|
Concept JOIN
$articles=Article:: join('article_descriptions','article_descriptions.article_id','=','articles.id')
->where('article_descriptions.language',Session::get('language'))
->where('article_descriptions.name','like','%'.$request->keyword.'%')
->where('articles.status','on')
->orderBy('articles.id','desc')
->where('articles.id','<',$request->id)
->select('articles.*')
->limit(5)
->get();
เรื่องการ query รอท่านอื่นเขียนตัวอย่าง SQL แล้วมา dev กับส่วนที่ให้ไปด้านบน
|
 |
 |
 |
 |
Date :
2021-07-08 12:42:00 |
By :
Genesis™ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (SQL)
select * from b
union all
select * from c
|
 |
 |
 |
 |
Date :
2021-07-08 14:02:46 |
By :
Chaidhanan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (SQL)
select id, group, id_a, 'b' as frm from b
union all
select id, group, id_a, 'c' from c
|
 |
 |
 |
 |
Date :
2021-07-08 15:19:29 |
By :
Chaidhanan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|