SELECT t1.col1,t2.tempstr,t1.col3,case col4 when '0' then '零' when '1' then '一' when '2' then '二' when '3' then '三' end from table1 t1,table2 t2

解决方案 »

  1.   

    SELECT col1 , tempstr ,col3 ,
          CASE col4 WHEN '0' THEN '你的说明1' WHEN '1' THEN '你的说明2' WHEN '2' THEN '你的说明3'    WHEN '3' THEN '你的说明4' END AS name1,
     FROM table1 join table2 on tabel1.col2 = table2.id如上写你的sql语句然后把它fill到dataset 再绑定到datagrid中就可以拉!那个要根据不同值显示不同说明的绑定列为name1(你起的名字)
      

  2.   

    SELECT t1.col1,t2.tempstr,t1.col3,case col4 from table1 t1 inner join table2 t2 
    on t1.col2 = t2.id
      

  3.   

    建立一个VIEW然后从这个View中得到数据,你会发现OK了
      

  4.   

    col1 int 我取出后用加上一个常量字符串"abc"+col1作为显在datagrid列上,请问如何操作!
      

  5.   

    select ..."abc"+col1 as col1 .....
      

  6.   

    还可以在DataGrid的OnItemDataBound事件中:
    if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
    {
    String col = DataBinder.Eval(e.Item.DataItem, "col1").ToString();
    e.Item.Cells[5].Text="abc"+col1";
    }
      

  7.   

    因为这是一个超联接,<a href="url?id=col1">"acb"+url+</a>
      

  8.   

    请问table1中的col1对应table3其中要取得table3总数,以及table3中与col1相关的一列的总和,这个sql语句如何写!
      

  9.   

    SELECT a.*,COUNT(b.isread) AS readed, COUNT(b.RMAstrid)-COUNT(isread) AS notreaded
    FROM
    (
    SELECT a.RMAstrid,a.applydate,a.RMAid,
    COUNT(b.RMAstrid) AS quantity ,SUM(ISNULL(b.cost,0)) as costFROM tblRMA a INNER JOIN tblRMAItem b ON a.RMAstrid=b.RMAstrid GROUP BY
    a.RMAstrid,a.applydate,a.RMAid
    ) a 
    INNER JOIN tblRMAMessage b ON a.RMAstrid=b.RMAstrid
    GROUP BY a.RMAstrid,a.applydate,a.RMAid,a.quantity,a.cost
      

  10.   

    设置datagrid的datasource属性,当然要先设置sqldataconnection,sqldataadapter,dataset
      

  11.   

    对于上面的语句邦定的时,DataField的属性是a.RMAstrid嘛?
      

  12.   

    深表歉意,我写错了,更正如下
    SELECT t1.col1,t2.tempstr,t1.col3,case col4 when '0' then '零' when '1' then '一' when '2' then '二' when '3' then '三' end from table1 t1,table2 t2 where t1.col2=t2.id