第一种
select top 20 * from (select a.hot_level, a.hot_name,b.room_name,b.room_priceq,b.room_pricep,b.room_pricez,b.room_type,b.room_tuijian,b.id,a.hot_number,a.id as hotelid,a.hot_time,a.hot_pic from LI_hotel a,LI_room b where a.hot_number=b.room_hotelnumber) as a where hot_number like 'hotel%' and room_tuijian='1' and room_type='0'
第二种
select top 20 a.hot_level, a.hot_name,b.room_name,b.room_priceq,b.room_pricep,b.room_pricez,b.room_type,b.room_tuijian,b.id,a.hot_number,a.id as hotelid,a.hot_time,a.hot_level,a.hot_pic from LI_hotel a,LI_room b where a.hot_number=b.room_hotelnumber and hot_number like 'hotel%' and b.room_tuijian='1' and b.room_type='0'
数据的查询优化与表及索引的设置有关。
建议利用SQL的查询计划自己分析
当然是第二种咯,因为嵌套查询又重新去查了一次表