我想在
CREATE procedure report_KM
@m_begin int,
@m_end int,
@m_date varchar(20),
@m_startID int,
@m_endID int,
@m_FJIndex varchar(150),
@m_LineSpeed varchar(100)as
declare @minclass as int
select @minclass=min(class) from table1
select id=max(id),km=km,
speed=?????????????????????? //speed 为type=1时候的值
into #t3
from table1 where type>=0 and type<=3 group by idspeed 该怎么写了,请朋友指点了,小弟刚从事这方面的工作
CREATE procedure report_KM
@m_begin int,
@m_end int,
@m_date varchar(20),
@m_startID int,
@m_endID int,
@m_FJIndex varchar(150),
@m_LineSpeed varchar(100)as
declare @minclass as int
select @minclass=min(class) from table1
select id=max(id),km=km,
speed=?????????????????????? //speed 为type=1时候的值
into #t3
from table1 where type>=0 and type<=3 group by idspeed 该怎么写了,请朋友指点了,小弟刚从事这方面的工作
@m_begin int,
@m_end int,
@m_date varchar(20),
@m_startID int,
@m_endID int,
@m_FJIndex varchar(150),
@m_LineSpeed varchar(100)as
declare @minclass as int
select @minclass=min(class) from table1
select id=max(id),km=km,
speed=max(case when type=1 then speed else null end)
into #t3
from table1 where type>=0 and type<=3 group by id
speed=max(case when type=1 then speed else null end)
这一行吗?谢谢了