SQL语句(100)

  • 主题发起人 主题发起人 bigness
  • 开始时间 开始时间
B

bigness

Unregistered / Unconfirmed
GUEST, unregistred user!
有一表P_ID,S_ID,P_Number,P_Money 1, 2 , 10 , 151, 3 , 15, 201, 4 , 20 , 25 怎样实现成P_ID,S_ID,S_ID1,S_ID2,P_Number,P_Money,P_Number1,P_Money1,P_Number2,P_Money21 ,2 , 3 , 4 , 10 , 15 , 15, 20 ,20 ,25
 
新手等答案
 
SELECT MIN(P_ID) as P_ID,MIN(S_ID) AS S_ID,AVG(S_ID) AS S_ID1,MAX(S_ID) AS S_ID2,MIN(P_Number) AS P_Number,MIN(P_Money) AS P_Money,AVG(P_Number) AS P_Number1,AVG(P_Money) AS P_Money1,MAX(P_Number) AS P_Number2,MAX(P_Money) AS P_Money2 FROM 表
 
写一个存储过程试试,看实现得了不.
 
多人接受答案了。
 
后退
顶部