主题:小弟向各位大哥请教!!
我用VB访问SQL数据库,用了两句查询语言,但效果太慢,效率低,还请各位大哥看看,指点一下,数据库里LineName一项内容后面加了好多空格,小弟SQL比较菜,希望大家不吝赐教!
sql3 = "select distinct 车次,时间,线路名,SeatType,余票 from VIEW11,RunSeatA where 车次=OrderNo and LineName<>'贵阳-凯里(专线) 'and LineName<>'贵阳-安顺 'and LineName<>'贵阳-遵义(大金龙) 'and LineName<>'贵阳-福泉 'and LineName<>'贵阳-都匀 'and LineName<>'贵阳-遵义(三星) 'and LineName<>'贵阳-遵义(小金龙) 'and LineName<>'贵阳-凯里 '"
sql5 = "select distinct 车次,时间,线路名,SeatType,余票 from VIEW11,RunSeatA where LineName='贵阳-凯里(专线) ' and 车次=OrderNo or LineName='贵阳-安顺 ' and 车次=OrderNo or LineName='贵阳-遵义(大金龙) ' and 车次=OrderNo or LineName='贵阳-福泉 ' and 车次=OrderNo or LineName='贵阳-都匀 ' and 车次=OrderNo or LineName='贵阳-遵义(三星) ' and 车次=OrderNo or LineName='贵阳-遵义(小金龙) ' and 车次=OrderNo" '"
sql3 = "select distinct 车次,时间,线路名,SeatType,余票 from VIEW11,RunSeatA where 车次=OrderNo and LineName<>'贵阳-凯里(专线) 'and LineName<>'贵阳-安顺 'and LineName<>'贵阳-遵义(大金龙) 'and LineName<>'贵阳-福泉 'and LineName<>'贵阳-都匀 'and LineName<>'贵阳-遵义(三星) 'and LineName<>'贵阳-遵义(小金龙) 'and LineName<>'贵阳-凯里 '"
sql5 = "select distinct 车次,时间,线路名,SeatType,余票 from VIEW11,RunSeatA where LineName='贵阳-凯里(专线) ' and 车次=OrderNo or LineName='贵阳-安顺 ' and 车次=OrderNo or LineName='贵阳-遵义(大金龙) ' and 车次=OrderNo or LineName='贵阳-福泉 ' and 车次=OrderNo or LineName='贵阳-都匀 ' and 车次=OrderNo or LineName='贵阳-遵义(三星) ' and 车次=OrderNo or LineName='贵阳-遵义(小金龙) ' and 车次=OrderNo" '"