tbCategory表
categoryID categoryName
1 a
2 btbItem表
itmeID itemName categoryID
1 aaa 1
2 bbb 1
3 ccc 2我想将tbCategory表中categoryName = a的数据 在tbItem表中对应的itemName 的内容前面加一个 * 号
希望结果如下
tbItem表
itmeID itemName categoryID
1 *aaa 1
2 *bbb 1
3 *ccc 2
categoryID categoryName
1 a
2 btbItem表
itmeID itemName categoryID
1 aaa 1
2 bbb 1
3 ccc 2我想将tbCategory表中categoryName = a的数据 在tbItem表中对应的itemName 的内容前面加一个 * 号
希望结果如下
tbItem表
itmeID itemName categoryID
1 *aaa 1
2 *bbb 1
3 *ccc 2
解决方案 »
- sql sever2005 无法导入和导出到excel表
- Sql链接过多问题
- 估计简单但我不会的问题
- 求sql语句
- 通过一个循环批量insert数据时被插入表有for insert触发器,该触发器是在循环结束以后触发还是在每次插入之时?
- 100分,求"关于库存的先进先出成本核算"的数据库表结构.请有实际项目经验的高人指教.
- ----求一条sql语句-----
- SQL排序
- 为什么从ACCESS到SQL SERVER 我的丢失了表的主建定义,和关联定义
- 我用ADO连接SQL server数据库看看这样行吗??????
- 急急:SQL2005数据库附加及权限设置
- if @@error>0 raiserror(@@error...这样写会不会有问题?
select itemID,(case when categoryID in (select categoryID from tbCategory where categoryname = 'a')
then '*' + itemname else itemname end)itemname,categoryID
from tbItem
update tbItem
set categoryName = '*' + categoryName
where categoryID in (select categoryID from tbCategory where categoryname = 'a')
from tbCategory a,tbItem b
where a.categoryID =b.categoryID