我们正在使用 SQL Server 2017 Express,我有这个 SELECT 语句:
SELECT * FROM
(SELECT '' as ItemId, '-- Please select --' as ItemDesc
UNION
SELECT [id] as ItemId, [DisplayName] as ItemDesc
FROM [table]
) as t
ORDER BY
CASE ItemDesc
when '-- Please select --' then 1
when 'bla' then 2
when 'fasel' then 3
when 'blubb' then 4
when 'lala' then 5
when 'duh!' then 6
when 'spamalot' then 7
else 8
end, ItemDesc
这可行,但我需要在 pos 添加第二个“静态”行。8、类似的东西
SELECT * FROM
(SELECT '' as ItemId, '-- Please select --' as ItemDesc,
'' as ItemId, '----------' as ItemDesc
UNION
...
CASE ItemDesc
...
when '----------' then 8
else 9
当然这不起作用,但你明白了。不幸的是,我无法访问创建列表的代码,我所能做的就是将 Javascript 添加到输出中。
这有可能吗?不使用 JS 并操作 DOM 是否有意义?