在界面上有一个combobox,它的下拉选项有11项,内容是从第一路口到第十路口,最后一项是
全部路口,共11项,在数据库中每个路口都有对应项,查询显示起来不难,我现在想选择全部路口这个选项,就要把从第一路口到第十路口的全部数据显示到dbgrid中去,我该如何做,请指教。

解决方案 »

  1.   

    select * from 表 where 字段=  "XXX条件1"
    ...
    select * from 表 where 字段=  "XXX条件10"select * from 表 where (字段1 like "XXX条件11%")or(字段2 like "XXX条件11%")....
      

  2.   

    for the first road
    select * from your_table where your_field = first_roadfor the second road, like first one, and so onfor the last road(select 11 in combobox)
    select * from your_table (not use any condition) 
    or
    select * from your_table where your_field in (first_road, second_road, .. so on)
      

  3.   

    一楼的方法就可以,like + or
    如果你这十个路口的字段名有且只有这十个路口有重复内容的话,一个like就可以,不知道你明白没,呵呵,举个例子吧,假如这十个路口的字段叫road1 road2- road10,你就可以直接 like "road%",但如果还有其他字段也叫roadxxx,那就只能一个一个的or了,就是一楼的方法