[英]Azure Cosmos DB SQL API
I am trying to run this query我正在尝试运行此查询
SELECT c.foodGroup,
c.description,
ch.amount,
ch.weightInGrams
***--ch.description***
FROM c
join ch in c.servings
where c.id = '21272'
The weightingrams
and description
are key value pairs in servings
. weightingrams
和description
是servings
中的键值对。 The value weightingrams
shows up but the description
doesn't show up.值
weightingrams
显示,但description
不显示。
I have tried description
and [description]
but it throws an error saying that description
has been used more than once.我已经尝试过
description
和[description]
,但它会抛出一个错误, description
已被多次使用。 What's the way around for this?这有什么办法?
This is in reference to food.json
as provided by cosmosdb try sql api.这是参考
food.json
提供的 food.json 尝试 sql api。
Also providing the json:还提供 json:
{
"id": "21272",
"description": "PIZZA HUT 12\" Cheese Pizza, Pan Crust",
"tags": [
{
"name": "pizza hut 12\" cheese pizza"
},
{
"name": "pan crust"
}
],
"version": 1,
"manufacturerName": "Pizza Hut, Inc.",
"foodGroup": "Fast Foods",
"nutrients": [
{
"id": "203",
"description": "Protein",
"nutritionValue": 11.73,
"units": "g"
},
{
"id": "208",
"description": "Energy",
"nutritionValue": 280,
"units": "kcal"
},
{
"id": "209",
"description": "Starch",
"nutritionValue": 21.22,
"units": "g"
},
{
"id": "210",
"description": "Sucrose",
"nutritionValue": 0,
"units": "g"
},
{
"id": "211",
"description": "Glucose (dextrose)",
"nutritionValue": 0.41,
"units": "g"
},
{
"id": "304",
"description": "Magnesium, Mg",
"nutritionValue": 21,
"units": "mg"
},
{
"id": "305",
"description": "Phosphorus, P",
"nutritionValue": 241,
"units": "mg"
},
{
"id": "315",
"description": "Manganese, Mn",
"nutritionValue": 0.305,
"units": "mg"
},
{
"id": "341",
"description": "Tocopherol, beta",
"nutritionValue": 0.05,
"units": "mg"
},
{
"id": "342",
"description": "Tocopherol, gamma",
"nutritionValue": 3.48,
"units": "mg"
},
{
"id": "401",
"description": "Vitamin C, total ascorbic acid",
"nutritionValue": 0,
"units": "mg"
},
{
"id": "418",
"description": "Vitamin B-12",
"nutritionValue": 0.64,
"units": "µg"
},
{
"id": "501",
"description": "Tryptophan",
"nutritionValue": 0.125,
"units": "g"
},
{
"id": "504",
"description": "Leucine",
"nutritionValue": 1.044,
"units": "g"
},
{
"id": "601",
"description": "Cholesterol",
"nutritionValue": 21,
"units": "mg"
},
{
"id": "618",
"description": "18:2 undifferentiated",
"nutritionValue": 2.433,
"units": "g"
},
{
"id": "619",
"description": "18:3 undifferentiated",
"nutritionValue": 0.304,
"units": "g"
},
{
"id": "620",
"description": "20:4 undifferentiated",
"nutritionValue": 0.015,
"units": "g"
},
{
"id": "625",
"description": "14:1",
"nutritionValue": 0.053,
"units": "g"
},
{
"id": "307",
"description": "Sodium, Na",
"nutritionValue": 624,
"units": "mg"
},
{
"id": "309",
"description": "Zinc, Zn",
"nutritionValue": 1.63,
"units": "mg"
},
{
"id": "318",
"description": "Vitamin A, IU",
"nutritionValue": 260,
"units": "IU"
},
{
"id": "514",
"description": "Aspartic acid",
"nutritionValue": 0.753,
"units": "g"
},
{
"id": "516",
"description": "Glycine",
"nutritionValue": 0.322,
"units": "g"
},
{
"id": "610",
"description": "10:0",
"nutritionValue": 0.187,
"units": "g"
},
{
"id": "645",
"description": "Fatty acids, total monounsaturated",
"nutritionValue": 3.213,
"units": "g"
},
{
"id": "689",
"description": "20:3 undifferentiated",
"nutritionValue": 0,
"units": "g"
},
{
"id": "204",
"description": "Total lipid (fat)",
"nutritionValue": 12.56,
"units": "g"
},
{
"id": "205",
"description": "Carbohydrate, by difference",
"nutritionValue": 29.93,
"units": "g"
},
{
"id": "207",
"description": "Ash",
"nutritionValue": 2.39,
"units": "g"
},
{
"id": "212",
"description": "Fructose",
"nutritionValue": 0.42,
"units": "g"
},
{
"id": "255",
"description": "Water",
"nutritionValue": 43.4,
"units": "g"
},
{
"id": "268",
"description": "Energy",
"nutritionValue": 1170,
"units": "kJ"
},
{
"id": "269",
"description": "Sugars, total",
"nutritionValue": 3.21,
"units": "g"
},
{
"id": "306",
"description": "Potassium, K",
"nutritionValue": 168,
"units": "mg"
},
{
"id": "323",
"description": "Vitamin E (alpha-tocopherol)",
"nutritionValue": 1.06,
"units": "mg"
},
{
"id": "343",
"description": "Tocopherol, delta",
"nutritionValue": 1.15,
"units": "mg"
},
{
"id": "344",
"description": "Tocotrienol, alpha",
"nutritionValue": 0.05,
"units": "mg"
},
{
"id": "503",
"description": "Isoleucine",
"nutritionValue": 0.518,
"units": "g"
},
{
"id": "506",
"description": "Methionine",
"nutritionValue": 0.266,
"units": "g"
},
{
"id": "617",
"description": "18:1 undifferentiated",
"nutritionValue": 2.997,
"units": "g"
},
{
"id": "626",
"description": "16:1 undifferentiated",
"nutritionValue": 0.124,
"units": "g"
},
{
"id": "653",
"description": "17:0",
"nutritionValue": 0.048,
"units": "g"
},
{
"id": "303",
"description": "Iron, Fe",
"nutritionValue": 1.86,
"units": "mg"
},
{
"id": "347",
"description": "Tocotrienol, delta",
"nutritionValue": 0,
"units": "mg"
},
{
"id": "406",
"description": "Niacin",
"nutritionValue": 3.91,
"units": "mg"
},
{
"id": "430",
"description": "Vitamin K (phylloquinone)",
"nutritionValue": 15.5,
"units": "µg"
},
{
"id": "502",
"description": "Threonine",
"nutritionValue": 0.379,
"units": "g"
},
{
"id": "509",
"description": "Tyrosine",
"nutritionValue": 0.479,
"units": "g"
},
{
"id": "512",
"description": "Histidine",
"nutritionValue": 0.326,
"units": "g"
},
{
"id": "517",
"description": "Proline",
"nutritionValue": 1.253,
"units": "g"
},
{
"id": "606",
"description": "Fatty acids, total saturated",
"nutritionValue": 5.184,
"units": "g"
},
{
"id": "614",
"description": "18:0",
"nutritionValue": 1.203,
"units": "g"
},
{
"id": "851",
"description": "18:3 n-3 c,c,c (ALA)",
"nutritionValue": 0.304,
"units": "g"
},
{
"id": "213",
"description": "Lactose",
"nutritionValue": 0.47,
"units": "g"
},
{
"id": "405",
"description": "Riboflavin",
"nutritionValue": 0.251,
"units": "mg"
},
{
"id": "511",
"description": "Arginine",
"nutritionValue": 0.451,
"units": "g"
},
{
"id": "518",
"description": "Serine",
"nutritionValue": 0.648,
"units": "g"
},
{
"id": "613",
"description": "16:0",
"nutritionValue": 2.611,
"units": "g"
},
{
"id": "615",
"description": "20:0",
"nutritionValue": 0.025,
"units": "g"
},
{
"id": "697",
"description": "15:1",
"nutritionValue": 0,
"units": "g"
},
{
"id": "287",
"description": "Galactose",
"nutritionValue": 0.07,
"units": "g"
},
{
"id": "317",
"description": "Selenium, Se",
"nutritionValue": 19.4,
"units": "µg"
},
{
"id": "410",
"description": "Pantothenic acid",
"nutritionValue": 0.285,
"units": "mg"
},
{
"id": "429",
"description": "Dihydrophylloquinone",
"nutritionValue": 0,
"units": "µg"
},
{
"id": "513",
"description": "Alanine",
"nutritionValue": 0.386,
"units": "g"
},
{
"id": "515",
"description": "Glutamic acid",
"nutritionValue": 3.323,
"units": "g"
},
{
"id": "609",
"description": "8:0",
"nutritionValue": 0.082,
"units": "g"
},
{
"id": "611",
"description": "12:0",
"nutritionValue": 0.212,
"units": "g"
},
{
"id": "628",
"description": "20:1",
"nutritionValue": 0.027,
"units": "g"
},
{
"id": "646",
"description": "Fatty acids, total polyunsaturated",
"nutritionValue": 2.752,
"units": "g"
},
{
"id": "672",
"description": "20:2 n-6 c,c",
"nutritionValue": 0,
"units": "g"
},
{
"id": "291",
"description": "Fiber, total dietary",
"nutritionValue": 1.7,
"units": "g"
},
{
"id": "301",
"description": "Calcium, Ca",
"nutritionValue": 208,
"units": "mg"
},
{
"id": "312",
"description": "Copper, Cu",
"nutritionValue": 0.101,
"units": "mg"
},
{
"id": "346",
"description": "Tocotrienol, gamma",
"nutritionValue": 0,
"units": "mg"
},
{
"id": "415",
"description": "Vitamin B-6",
"nutritionValue": 0.107,
"units": "mg"
},
{
"id": "508",
"description": "Phenylalanine",
"nutritionValue": 0.615,
"units": "g"
},
{
"id": "612",
"description": "14:0",
"nutritionValue": 0.723,
"units": "g"
},
{
"id": "685",
"description": "18:3 n-6 c,c,c",
"nutritionValue": 0,
"units": "g"
},
{
"id": "687",
"description": "17:1",
"nutritionValue": 0.012,
"units": "g"
},
{
"id": "214",
"description": "Maltose",
"nutritionValue": 1.83,
"units": "g"
},
{
"id": "319",
"description": "Retinol",
"nutritionValue": 73,
"units": "µg"
},
{
"id": "320",
"description": "Vitamin A, RAE",
"nutritionValue": 73,
"units": "µg"
},
{
"id": "345",
"description": "Tocotrienol, beta",
"nutritionValue": 0,
"units": "mg"
},
{
"id": "404",
"description": "Thiamin",
"nutritionValue": 0.243,
"units": "mg"
},
{
"id": "505",
"description": "Lysine",
"nutritionValue": 0.693,
"units": "g"
},
{
"id": "507",
"description": "Cystine",
"nutritionValue": 0.156,
"units": "g"
},
{
"id": "510",
"description": "Valine",
"nutritionValue": 0.658,
"units": "g"
},
{
"id": "624",
"description": "22:0",
"nutritionValue": 0.018,
"units": "g"
},
{
"id": "652",
"description": "15:0",
"nutritionValue": 0.074,
"units": "g"
}
],
"servings": [
{
"amount": 1,
"description": "slice",
"weightInGrams": 100
},
{
"amount": 1,
"description": "pizza",
"weightInGrams": 728
}
]
}
I have tried description and [description] but it throws an error saying that decription has been used more than once.
我已经尝试过 description 和 [description],但它会抛出一个错误,说明 decriction 已被多次使用。
This is due to your name of property decription
is duplicate, you can try this sql:这是由于您的属性描述名称重复,您可以试试这个
decription
:
SELECT
c.foodGroup,
c.description,
ch.amount,
ch.weightInGrams,
ch.description as ch_description
FROM c
join ch in c.servings
where c.id = '21272'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.