  | 
				VFP 愛用者社區 本討論區為 Visual Foxpro 愛用者經驗交流的地方, 請多多利用"搜尋"的功能, 先查看看有無前例可循, 如果還有不懂的再發問. 部份主題有附加檔案, 須先註冊成為社區居民才可以下載.   
				 | 
			 
		 
		 
	
		| 上一篇主題 :: 下一篇主題   | 
	 
	
	
		| 發表人 | 
		內容 | 
	 
	
		cmj8992004
 
 
  註冊時間: 2004-09-22 文章: 10 來自: 天津
  第 1 樓
  | 
		
			
				 發表於: 星期六 九月 16, 2006 10:39 am    文章主題: 小數點問題 | 
				     | 
			 
			
				
  | 
			 
			
				我有個 sql 的統計語句,統計1~7月分的數據及7月份當月的數據
 
 
tsdate = '950101'
 
sdate = '950701'
 
edate = '950731'
 
 
select custpay3.code,;
 
     sum(iif(between(custpay3.date,sdate,edate),iif(custpay4.money4>0,custpay4.money4,0),0)) as ptotmoneyx,;
 
     sum(iif(between(custpay3.date,sdate,edate),iif(custpay4.qty>0,custpay4.qty,0),0)) as ptotqtyx,;
 
     sum(iif(between(custpay3.date,sdate,edate),iif(custpay4.qty>0,custpay4.qty*custpay4.wet,0),0)) as ptotwetx,;
 
     sum(iif(between(custpay3.date,sdate,edate),iif(custpay4.qty<0,custpay4.qty,0),0)) as mtotqtyx,;
 
     sum(iif(between(custpay3.date,sdate,edate),iif(custpay4.qty<0,custpay4.qty*custpay4.wet,0),0)) as mtotwetx,;
 
     sum(iif(between(custpay3.date,sdate,edate),iif(custpay4.money4<0,custpay4.money4,0),0)) as mtotmoneyx ,;
 
     sum(iif(custpay4.money4>0,custpay4.money4,0)) as ptotmoney,;
 
     sum(iif(custpay4.qty>0,custpay4.qty,0)) as ptotqty,;
 
     sum(iif(custpay4.qty>0,custpay4.qty*custpay4.wet,0)) as ptotwet,;
 
     sum(iif(custpay4.money4<0,custpay4.money4,0)) as mtotmoney,;
 
     sum(iif(custpay4.qty<0,custpay4.qty,0)) as mtotqty,;
 
     sum(iif(custpay4.qty<0,custpay4.qty*custpay4.wet,0)) as mtotwet ;
 
     from custpay3  inner join custpay4 on custpay3.number=custpay4.number inner join cargo1 on custpay3.number=str(cargo1.number,8 ) ;
 
     where custpay3.date between '&tsdate' and '&edate' and cargo1.china order by  custpay3.code group by custpay3.code into cursor custpaycn
 
 
 
其中欄位 custpay4.wet 有小數點,但經 sql 統計後臨時表的欄位 ptotwet,mtotwet是正確的,ptotwetx,mtotwetx 確沒有小數點.
 
 
是我的 sql 語法錯了,還是  VFP 9有 BUG. | 
			 
		  | 
	 
	
		| 回頂端 | 
		 | 
	 
	
		  | 
	 
	
		garfield Site Admin
  
  註冊時間: 2003-01-30 文章: 2160
 
  第 2 樓
  | 
		
			
				 發表於: 星期六 九月 16, 2006 11:13 am    文章主題:  | 
				     | 
			 
			
				
  | 
			 
			
				是不了解vfp特性, 不是bug
 
將0 改成 0.0000   則會有4位小數 _________________ 利用>>搜尋<<的功能會比問的還要快得到答案. | 
			 
		  | 
	 
	
		| 回頂端 | 
		 | 
	 
	
		  | 
	 
	
		cmj8992004
 
 
  註冊時間: 2004-09-22 文章: 10 來自: 天津
  第 3 樓
  | 
		
			
				 發表於: 星期六 九月 16, 2006 1:26 pm    文章主題:  | 
				     | 
			 
			
				
  | 
			 
			
				| 原來如此,謝謝了. | 
			 
		  | 
	 
	
		| 回頂端 | 
		 | 
	 
	
		  | 
	 
	
		 | 
	 
 
  
  	 
	    
  	   | 
 	
您 無法 在這個版面發表文章 您 無法 在這個版面回覆文章 您 無法 在這個版面編輯文章 您 無法 在這個版面刪除文章 您 無法 在這個版面進行投票 您 無法 在這個版面附加檔案 您 無法 在這個版面下載檔案
  | 
   
  
		 |