--发动机编码
create table MotorCode(
MotorCodeId int identity(1,1) primary key not null,
MotorCode varchar(50) not null
)
go--瓦片表
create table Tiles(
TilesId int identity(1,1) primary key not null,
TilesCode varchar(50) not null
)
go--发动机对应的瓦片
create table MotorCodeTiles(
MctId int identity(1,1) primary key not null,
MotorCodeId int not null,
TilesId int not null,
)
go--颜色表
create table TColors(
TcolorId int identity(1,1) primary key not null,
Tcolor varchar(20) not null
)
go--颜色对应的瓦片
create table TilesColor(
TilesColorId INT identity(1,1) primary key not null,
TilesId int not null,
TcolorId int not null
)
--查询发动机编号所对应的瓦片编号和瓦片颜色 要求 在 dataGrid 里显示 发动机编号 瓦片编号 瓦片颜色select MotorCode.MotorCode as 发动机编号,Tiles.TilesCode as 瓦片编号,TColors.TColor as 瓦片颜色from MotorCode,Tiles,TColors,MotorCodeTiles,TilesColor
where MotorCode.MotorCode='10242133' and Tiles.TilesId='122300105' and TColors.TColor='黄色' and MotorCodeTiles.MotorCodeId=MotorCode.MotorCodeId and MotorCodeTiles.TilesId=Tiles.TilesIdand TilesColor.TilesId=Tiles.TilesId and TilesColor.TcolorId=TColors.TcolorId 怎么写出来不对啊!
create table MotorCode(
MotorCodeId int identity(1,1) primary key not null,
MotorCode varchar(50) not null
)
go--瓦片表
create table Tiles(
TilesId int identity(1,1) primary key not null,
TilesCode varchar(50) not null
)
go--发动机对应的瓦片
create table MotorCodeTiles(
MctId int identity(1,1) primary key not null,
MotorCodeId int not null,
TilesId int not null,
)
go--颜色表
create table TColors(
TcolorId int identity(1,1) primary key not null,
Tcolor varchar(20) not null
)
go--颜色对应的瓦片
create table TilesColor(
TilesColorId INT identity(1,1) primary key not null,
TilesId int not null,
TcolorId int not null
)
--查询发动机编号所对应的瓦片编号和瓦片颜色 要求 在 dataGrid 里显示 发动机编号 瓦片编号 瓦片颜色select MotorCode.MotorCode as 发动机编号,Tiles.TilesCode as 瓦片编号,TColors.TColor as 瓦片颜色from MotorCode,Tiles,TColors,MotorCodeTiles,TilesColor
where MotorCode.MotorCode='10242133' and Tiles.TilesId='122300105' and TColors.TColor='黄色' and MotorCodeTiles.MotorCodeId=MotorCode.MotorCodeId and MotorCodeTiles.TilesId=Tiles.TilesIdand TilesColor.TilesId=Tiles.TilesId and TilesColor.TcolorId=TColors.TcolorId 怎么写出来不对啊!
from MotorCode a,Tiles b,TColors c,MotorCodeTiles d,TilesColor e
where a.MotorCode='10242133' and
a.MotorCodeId=d.MotorCodeId and d.TilesId=b.TilesId
and b.TilesId=e.TilesId and e.TcolorId=c.TcolorId