有没有一种方法可以合并两个表,但是将第一个表中的行保留在结果集中的最前面?但是,orderby列不在选择查询中
例如:
表格1
name surname
-------------------
John Doe
Bob Marley
Ras Tafari
Run Code Online (Sandbox Code Playgroud)
表2
name surname
------------------
Lucky Dube
Abby Arnold
Result
Run Code Online (Sandbox Code Playgroud)
预期结果:
name surname
-------------------
John Doe
Bob Marley
Ras Tafari
Lucky Dube
Abby Arnold
Run Code Online (Sandbox Code Playgroud)
我通过以下查询带来数据
SELECT name,surname FROM TABLE 1 ORDER BY ID
UNION
SELECT name,surname FROM TABLE 2
Run Code Online (Sandbox Code Playgroud)
上面的查询并没有跟踪联合之后的顺序。
PS-我不想在我的选择查询中显示ID,我
通过连接表获得ORDER BY Column。以下是我的真实查询
SELECT tbl_Event_Type_Sort_Orders.Appraisal_Event_Type_ID AS Appraisal_Event_Type_ID , ISNULL(tbl_Appraisal_Event_Types.Appraisal_Event_Type_Display_Name, 'UnCategorized') AS Appraisal_Event_Type_Display_Name
INTO #temptbl
FROM tbl_Event_Type_Sort_Orders
INNER JOIN tbl_Appraisal_Event_Types
ON tbl_Event_Type_Sort_Orders.Appraisal_Event_Type_ID = tbl_Appraisal_Event_Types.Appraisal_Event_Type_ID
WHERE 1=1
AND User_Name='abc'
ORDER …Run Code Online (Sandbox Code Playgroud) 我正在使用 JSON.NET 来解析我的 JSON:
JObject jsonObject = JObject.Parse(myJson);
Run Code Online (Sandbox Code Playgroud)
我的 JSON 看起来像这样:
{
"_links": {
"self": {
"href": "https://api-uat.dwolla.com/accounts/069b759d-6267-42d6-b30b-5d03ddd25673/funding-sources",
"type": "application/vnd.dwolla.v1.hal+json",
"resource-type": "funding-source"
}
},
"_embedded": {
"funding-sources": [
{
"_links": {
"self": {
"href": "https://api-uat.dwolla.com/funding-sources/0b2f6a31-b909-4c7d-a9f8-6253e5f791d0",
"type": "application/vnd.dwolla.v1.hal+json",
"resource-type": "funding-source"
},
"account": {
"href": "https://api-uat.dwolla.com/accounts/069b759d-6267-42d6-b30b-5d03ddd25673",
"type": "application/vnd.dwolla.v1.hal+json",
"resource-type": "account"
},
"balance": {
"href": "https://api-uat.dwolla.com/funding-sources/0b2f6a31-b909-4c7d-a9f8-6253e5f791d0/balance",
"type": "application/vnd.dwolla.v1.hal+json",
"resource-type": "balance"
}
},
"id": "0b2f6a31-b909-4c7d-a9f8-6253e5f791d0",
"status": "verified",
"type": "bank",
"name": "Bank Of America",
"created": "2017-03-22T12:54:51.000Z",
"removed": false,
"channels": [
"ach"
],
"bankName": "SANDBOX TEST …Run Code Online (Sandbox Code Playgroud)