我有一個表格中有以下數據,我試圖從表格中獲取最大值和最小值列。如果它是一列,我可以使用列的最大/最小值,但在這裏我是比較表中的所有列。我需要的是添加新列以存儲最大和最小數據。從表中列的最大值和最小值
而且將只有一個行的表提前
create table
#test (column1 int, column2 int , column3 int , column4 int ,column5 int,column6 int)
insert into #test
values(89, 103,87,67,86,56)
select * from #test
--drop table #test
感謝。
您可以取消轉換序列(https://technet.microsoft.com/en-us/library/ms177410(v=sql.105).aspx),然後取最大值/最小值 – Jeremy