with temp as (
select a.*,prices.price as retprice,prices.indate from tourname as a join
(select b.tourname,c.price,b.indate from tourgroup as b join groupprice as c on c.groupno=b.groupno
where c.item='1') as prices on a.tourname=prices.tourname and prices.indate>=getdate() and grp='粤北'
)
select * from temp as a where indate=(select min(indate) from temp as b where a.tourname=b.tourname)
select a.*,prices.price as retprice,prices.indate from tourname as a join
(select b.tourname,c.price,b.indate from tourgroup as b join groupprice as c on c.groupno=b.groupno
where c.item='1') as prices on a.tourname=prices.tourname and prices.indate>=getdate() and grp='粤北'
)
select * from temp as a where indate=(select min(indate) from temp as b where a.tourname=b.tourname)