我是宇宙的新手,我有一个收藏夹,我试图查询下面的示例。 因为数据的本质是嵌套的。我们还必须能够查询文档的子部分。
我在尝试检索以下集合中itemCode的数据时陷入困境。
任何信息都会有很大帮助。预先感谢。
选择*来自c 其中c.customerSites.pricingGroup.itemCode =“ 2400953”
此查询没有返回结果。
{
"customerSites": [
{
"customerCode": "196729",
"businessUnitName": "XXXXX SOUTHERN LTD",
"siteCode": "96271",
"addressCode": "_MAINXXXX",
"pricingGroup": [
{
"itemCode": 2400953,
"branches": [
8999,
3001,
3002,
3003,
3004
],
"rates": [
{
"branchCodes": [
8999,
3001,
3002,
3003
],
"discountPercentage": null,
"derivedRateId": 77735584,
"derivedRateClassification": "customrate",
"branchLevel": 109,
"derivedRateType": "P",
"durationRates": [
{
"durationType": 1,
"rate": 125
}
]
}
]
}
]
}
],
"id": "196729",
"dataType": "AccountCustomer",
"_ts": 1547161022
}
答案 0 :(得分:1)
只需:
//this is the php code with the call to the table with the images
<div class="display_CNC_Machining_images">
<?php
include_once 'includes/dbh.inc.php';
$sql = "SELECT * FROM gallery WHERE image_category = 'CNC_Machinery'";
$stmt = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt,$sql)) {
echo 'SQL statement failed!';
} else {
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
while ($row = mysqli_fetch_assoc($result)) {
//what's echoed out by the database
echo ' <a class="images" style="background-repeat:no-repeat; background-image: url(gallery/'.$row["imgFullNameGallery"].')">
<div class="color-overlay">
<h3>'.$row["titleGallery"].'</h3>
<p>'.$row["descGallery"].'</p>
</div>
</a>';
}
}
?>
</div>