我在Laravel中有以下表格。
id name
1 honda
2 suzuki
id name
1 cars
2 bikes
id name type_id
1 honda amaze 1
2 honda shine 2
3 suzuki baleno 1
4 suzuki racing 2
id brand_id make_id
1 1 1
2 1 2
3 2 3
4 2 4
id brand_id type_id
1 1 1
2 1 2
3 2 1
4 2 2
现在从上表中如何获取所有具有type_id = 1
的品牌商标?例如。给我所有的本田汽车
答案 0 :(得分:0)
var clientContext;
var website;
// Make sure the SharePoint script file 'sp.js' is loaded before your
// code runs.
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', sharePointReady);
// Create an instance of the current context and get the website.
function sharePointReady() {
clientContext = SP.ClientContext.get_current();
website = clientContext.get_web();
clientContext.load(website);
clientContext.executeQueryAsync(onRequestSucceeded, onRequestFailed);
}
function onRequestSucceeded() {
alert('URL of the website: ' + website.get_url());
}
function onRequestFailed(sender, args) {
alert('Error: ' + args.get_message());
}
答案 1 :(得分:0)
DB::table('brands')->join('brand_makes')->on('brands.id', '=, 'brand_makes.brand_id')
->join('makes')->on('makes.id', '=', 'brand_makes.make_id')
->join('types')->on('types.id', '=', 'makes.type_id)
->select('makes.name')
->where('types.name', 'cars')
->where('brands.name', 'yourRequiredBrand')
->get()