1.
select * from [order details]
3.
select * from (
select user, pass from t1
union all
select user, pass from t2) A
where user = 11 and pass = 22

解决方案 »

  1.   

    1.
      表名或列名如果有空格,就要用[]来引用
      select orderid as [order id],* from [order details]
      

  2.   

    2.
      没有直接方法,用动态生成SQL语句的方法
      delcare @sql varchar(8000)
      set @sql=''
      selct @sql=@sql+',['+name+']' from syscolumns where id=object_id('你要查询的表名') and name<>'你不想显示的列'
      set @sql='select '+right(@sql,len(@sql)-1)+ ' from 你要查询的表名'
      exec(@sql)
      

  3.   

    3.
      select * from (
           select * from t1
               union all
           select * from t2) a
      where user = 11 and pass = 22如果只想返回一条记录,就用:
      select top 1 * from (
           select * from t1
               union all
           select * from t2) a
      where user = 11 and pass = 22