|
本帖最后由 andanok 于 2013-8-18 20:22 编辑
根据表1和表2数据,生成表3
取表1中 ParentCategoryId=0 的 CategoryId,与表2中 IsMemberCreated=0 的数据,交集生成表3
求 MSSQL 2000 的 Insert Into 语句
谢谢
表格做说明
MSSQL 条件交集插入数据.rar
(8.83 KB, 下载次数: 12)
表1 | | | 表2 | | | | | CategoryId | ParentCategoryId | RankId | IsMemberCreated | PriceType | PriceOperations | PriceValue | 100 | 0 | 1 | 0 | SalePrice | * | 0.95 | 101 | 100 | 2 | 0 | SalePrice | * | 0.92 | 102 | 100 | 3 | 0 | SalePrice | * | 0.88 | 103 | 100 | 4 | 0 | SalePrice | * | 0.85 | 104 | 100 | 5 | 0 | SalePrice | * | 1 | 105 | 100 | 6 | 0 | SalePrice | * | 0.95 | 106 | 100 | 7 | 0 | SalePrice | * | 0.92 | 200 | 0 | 8 | 0 | SalePrice | * | 0.88 | 201 | 200 | 238401 | 1 | SalePrice | * | 1 | 202 | 200 | 238402 | 1 | SalePrice | * | 0.98 | 203 | 200 | 238403 | 1 | SalePrice | * | 0.95 | 204 | 200 | 238404 | 1 | SalePrice | * | 0.92 | 205 | 200 | 238405 | 1 | SalePrice | * | 0.9 | 206 | 200 | 239101 | 1 | SalePrice | * | 1 | 300 | 0 | 239102 | 1 | SalePrice | * | 0.98 | 301 | 300 | 239103 | 1 | SalePrice | * | 0.95 | 302 | 300 | | 303 | 300 | 304 | 300 |
表3 | | | | | RankId | CategoryId | PriceType | PriceOperations | PriceValue | 1 | 100 | SalePrice | * | 0.95 | 1 | 200 | SalePrice | * | 0.95 | 1 | 300 | SalePrice | * | 0.95 | 1 | 400 | SalePrice | * | 0.95 | 2 | 100 | SalePrice | * | 0.92 | 2 | 200 | SalePrice | * | 0.92 | 2 | 300 | SalePrice | * | 0.92 | 2 | 400 | SalePrice | * | 0.92 | 3 | 100 | SalePrice | * | 0.88 | 3 | 200 | SalePrice | * | 0.88 | 3 | 300 | SalePrice | * | 0.88 | 3 | 400 | SalePrice | * | 0.88 | 4 | 100 | SalePrice | * | 0.85 | 4 | 200 | SalePrice | * | 0.85 | 4 | 300 | SalePrice | * | 0.85 | 4 | 400 | SalePrice | * | 0.85 | 5 | 100 | SalePrice | * | 1 | 5 | 200 | SalePrice | * | 1 | 5 | 300 | SalePrice | * | 1 | 5 | 400 | SalePrice | * | 1 | 6 | 100 | SalePrice | * | 0.95 | 6 | 200 | SalePrice | * | 0.95 | 6 | 300 | SalePrice | * | 0.95 | 6 | 400 | SalePrice | * | 0.95 | 7 | 100 | SalePrice | * | 0.92 | 7 | 200 | SalePrice | * | 0.92 | 7 | 300 | SalePrice | * | 0.92 | 7 | 400 | SalePrice | * | 0.92 | 8 | 100 | SalePrice | * | 0.88 | 8 | 200 | SalePrice | * | 0.88 | 8 | 300 | SalePrice | * | 0.88 | 8 | 400 | SalePrice | * | 0.88 |
|
|