select Name, Event = STUFF((SELECT ', ' + Event
FROM events b
WHERE b.Name = a.Name
FOR XML PATH('')), 1, 2, ''), max(Date)
from events a
group by Name
我希望{
"email": "005foobar@gmail.com",
"phone": "9867534210",
"country_code": "91",
"firstname":"Rakesh",
"surname" :"A R"
}
或firstname
在我的请求中(例如:"名字"或"姓氏")
例如:
surname
或
{
"email": "005foobar@gmail.com",
"phone": "9867534210",
"country_code": "91",
"firstname":"Rakesh"
}
根据我的要求,你能帮助我使用json架构吗?
答案 0 :(得分:0)
例如像这样的东西。这有点复杂,但是如果你想要姓氏或者fisrtName,但不是在一起而不是没有它们就是你需要的。
{
"$schema": "http://json-schema.org/draft-04/schema#",
"definitions": {
"email": {
"type": "string"
},
"phone": {
"type": "string"
},
"country_code": {
"type": "string"
}
},
"type": "object",
"oneOf": [
{
"properties": {
"email": {
"$ref": "#/definitions/email"
},
"phone": {
"$ref": "#/definitions/phone"
},
"county_code": {
"$ref": "#/definitions/country_code"
},
"firstname": {
"type": "string"
}
},
"required": [
"email",
"phone",
"country_code",
"firstname"
]
},
{
"properties": {
"email": {
"$ref": "#/definitions/email"
},
"phone": {
"$ref": "#/definitions/phone"
},
"county_code": {
"$ref": "#/definitions/country_code"
},
"surname": {
"type": "string"
}
},
"required": [
"email",
"phone",
"country_code",
"surname"
]
}
]
}