日期:2014-05-17  浏览次数:20567 次

请教一个查询优化问题
我使用MS-SQL 2008 建了如下两表:

if exists (select 1
            from  sysobjects
           where  id = object_id('T_CANVERSION')
            and   type = 'U')
   drop table T_CANVERSION
go

/*==============================================================*/
/* Table: T_CANVERSION                                          */
/*==============================================================*/
create table T_CANVERSION (
   versionID            int                  identity
        constraint CKC_VERSIONID_T_CANVER check (versionID >= 1),
   versionName          varchar(30)          not null,
   groupID              char(9)              not null,
   carType              int                  not null,
   constraint PK_T_CANVERSION primary key  (versionID)
)
go

if exists (select 1
            from  sysobjects
           where  id = object_id('T_CANDATA')
            and   type = 'U')
   drop table T_CANDATA
go

/*==============================================================*/
/* Table: T_CANDATA                                             */
/*==============================================================*/
create table T_CANDATA (
   intID                int                  identity
        constraint CKC_INTID_T_CANDAT check (intID >= 0),
   strCtrlorName        varchar(50)          not null,
   strCanID             varchar(20)          not null,
   intOperate           int