现在的位置: 首页 > 综合 > 正文

left join

2011年03月12日 ⁄ 综合 ⁄ 共 794字 ⁄ 字号 评论关闭

有两表a和b,前两字段完全相同:(id int,name varchar(10)...),都有下面的数据(当然还有其它字段,这里不列出来了):
id          name      
----------- ----------
1           a         
2           b         
3           c         

以下的查询语句,你知道它的运行结果吗?:
1.
select * from a left join b on a.id=b.id where a.id=1
2.
select * from a left join b on a.id=b.id and a.id=1
3.
select * from a left join b on a.id=b.id and b.id=1
4.
select * from a left join b on a.id=1

Math.Round 方法准确的讲不是四舍五入,应为"返回最接近指定值的整数"。不能使用
 Math.Round(3.45, 1); //Returns 3.4.

应采用
 public static Round(decimal c,int p)
 {
  System.Text.StringBuilder str = new System.Text.StringBuilder("#.");
  for(int i=0; i<p; i++)
   str.Append("#");
  /*加上下面一句也可以,麻烦一点
  str.Append(";-"+str.ToString()+";0.00");
  */
  return  Convert.ToDecimal( c.ToString( str.ToString() ) );
 }

 public decimal Round(decimal c,int p)
 {
  return Decimal.Parse( c.ToString( "#.".PadRight(p+2,'0') ) );
 }

抱歉!评论已关闭.