比如数据库里本来就有
1 东
2 西
3 南
……
这张表
gridview可能是这样:
编码
1
2
2
3
1
4
6
4
…… 我想在点击按钮时 把这一列变成对应的
东
西
西
南
北
……
请问如何写这个sql语句?
1 东
2 西
3 南
……
这张表
gridview可能是这样:
编码
1
2
2
3
1
4
6
4
…… 我想在点击按钮时 把这一列变成对应的
东
西
西
南
北
……
请问如何写这个sql语句?
编码 mame
1 东
2 西
3 南
……
这张表ta select b.name
from gridview a
left join ta b
on a.编码 = b.编码
col1 col2
1 东
2 西
3 南
…… gridview
编码
1
2
2
3
1
4
6
4
…… select tb1.col2 from tb1 , tb2 where tb1.col1 = tb2.编码
from tb a inner join ta b on a.编码 = b.编码
在控件的点击事件中重新绑定数据源
如果是用了ajax的话,记得调用updatepanel的update方法
select table1.col2 from table1 , table2 where table1.col1 = table2.编码
declare @tableA table (id int,fx varchar(4))
insert into @tableA
select 1,'东' union all
select 2,'西' union all
select 3,'南' union all
select 4,'北' union all
select 5,'东南' union all
select 6,'西北'select * from @tableA
declare @tableB table (编码 int)
insert into @tableB
select 1 union all
select 2 union all
select 2 union all
select 3 union all
select 1 union all
select 4 union all
select 6 union all
select 4select * from @tableBselect b.编码 , a.fx from @tableA a right join @tableB b on b.编码=a.id
/*
编码 fx
----------- ----
1 东
2 西
2 西
3 南
1 东
4 北
6 西北
4 北
*/