VFP 愛用者社區 首頁 VFP 愛用者社區
本討論區為 Visual Foxpro 愛用者經驗交流的地方, 請多多利用"搜尋"的功能, 先查看看有無前例可循, 如果還有不懂的再發問. 部份主題有附加檔案, 須先註冊成為社區居民才可以下載.
 
 常見問題常見問題   搜尋搜尋   會員列表會員列表   會員群組會員群組   會員註冊會員註冊 
 個人資料個人資料   登入檢查您的私人訊息登入檢查您的私人訊息   登入登入

SQL語法

 
發表新主題   回覆主題    VFP 愛用者社區 首頁 -> SQL 討論區
上一篇主題 :: 下一篇主題  
發表人 內容
Terry1211



註冊時間: 2008-03-13
文章: 63


第 1 樓

發表發表於: 星期日 三月 16, 2008 4:20 pm    文章主題: SQL語法 引言回覆

請問
VFP裡,是否有如同MS SQL裡的 select case end的使用法,
沒有的話,是否有其他的函數或是語法可以達到相同結果,
EX:
性別欄位,bit為資料型態,要顯示1 會變成男 ; 0 會變成女
select case column_name
when '1' then '男'
when '0' then '女'
else '中' End as SEX
from table_name
回頂端
檢視會員個人資料 發送私人訊息
nelsonchuang



註冊時間: 2003-09-04
文章: 563
來自: 臺灣

第 2 樓

發表發表於: 星期一 三月 17, 2008 4:07 pm    文章主題: 引言回覆

先查一下help 以及論壇吧~
_________________
大家好,請多指教
回頂端
檢視會員個人資料 發送私人訊息
Terry1211



註冊時間: 2008-03-13
文章: 63


第 3 樓

發表發表於: 星期一 三月 17, 2008 4:54 pm    文章主題: 引言回覆

To nelsonchuang~~
請問要打什麼關鍵字找,小弟我找過Help跟MSDN,
我都找不到跟VFP有關的資料,能否告知~~
回頂端
檢視會員個人資料 發送私人訊息
garfield
Site Admin


註冊時間: 2003-01-30
文章: 2157


第 4 樓

發表發表於: 星期一 三月 17, 2008 11:44 pm    文章主題: 引言回覆

這裡有 VFP6及vfp8 HELP 可以下載 http://vfp.sunyear.com.tw/viewtopic.php?t=3249&highlight=vfp6+help
vfp9 help 在 http://vfp.sunyear.com.tw/viewtopic.php?t=4021
查 iif( )
因為你問的問題屬於基本功夫,
將 HELP 看一遍看會比較快進入狀況.

_________________
利用>>搜尋<<的功能會比問的還要快得到答案.
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件
nelsonchuang



註冊時間: 2003-09-04
文章: 563
來自: 臺灣

第 5 樓

發表發表於: 星期二 三月 18, 2008 8:45 am    文章主題: 引言回覆

你不是在找case endcase嗎?論壇中你只要找這些字就會有啦,sql的字,查詢也會有
_________________
大家好,請多指教
回頂端
檢視會員個人資料 發送私人訊息
syntech



註冊時間: 2003-05-16
文章: 4211
來自: Taipei,Taiwan

第 6 樓

發表發表於: 星期二 三月 18, 2008 8:58 am    文章主題: 引言回覆

路過,純推不下.
_________________
如果公司有下列困擾:
1. 找不到便宜,快速,簡易的 生產排程軟體
2. 不知道如何快速排定 採購計劃
3. 成本抓不準,自己算比軟體算有用
4. 想學習系統規劃,想找系統架構的顧問

請聯絡我們,也許我們幫得上忙
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 AIM Address
Terry1211



註冊時間: 2008-03-13
文章: 63


第 7 樓

發表發表於: 星期一 三月 24, 2008 10:03 pm    文章主題: 引言回覆

To garfield~~
感謝您的指導,IIF是小弟尋找的函數,謝謝您 ^^
回頂端
檢視會員個人資料 發送私人訊息
lcm



註冊時間: 2004-12-27
文章: 45


第 8 樓

發表發表於: 星期三 四月 16, 2008 5:23 pm    文章主題: 引言回覆

在vfp 9內尚有一函數ICASE.
HELP 內容如下:
Evaluates the results from a list of conditions.



ICASE( lCondition1, eResult1 [, lCondition2, eResult2] ...

[, eOtherwiseResult])



Parameters
lCondition
Specifies a condition as a logical expression to evaluate.

If lCondition evaluates to False (.F.), ICASE( ) continues to evaluate the next condition and returns the corresponding eResult for that condition if it evaluates to True (.T.). If lCondition evaluates to null (.NULL.), Visual FoxPro treats lCondition as if it evaluated to False (.F.).

eResult
Specifies a result to return if lCondition evaluates to True (.T.).

eOtherwiseResult
Contains the result returned if all conditions evaluate to False (.F.).

Return Value
ICASE( ) returns the first eResult as soon as lCondition evaluates to True (.T.).

If all conditions evaluate to False (.F.), ICASE( ) returns eOtherwiseResult.

If eOtherwiseResult is omitted, and all conditions evaluate to False (.F.), ICASE( ) returns null (.NULL.).

Remarks
You must always pass a set of two parameters to ICASE( ). If you pass an odd number of parameters, the last parameter is treated as the return value for eOtherwiseResult.

You can pass up to 100 pairs of parameters for ICASE( ).

If you use a long ICASE( ) expression in a filter expression, such as in a FOR or WHERE clause, make sure that SYS(3055) is set to an appropriate complexity level to avoid generating an error. For more information, see SYS(3055) - FOR and WHERE Clause Complexity.

Example
The following example demonstrates different scenarios using ICASE( ) to evaluate expressions and returning certain values based on the results of those expressions.

The following line of code displays "First is true" because the first expression evaluates to True (.T.).

? ICASE(1+1=2,"First is true",1+1=3,"Second is false","None are true")


The following line of code displays "Second is true" because the first expression evaluates to False (.F.), but the second expression evaluates to True (.T.).

? ICASE(1+2=2,"First is false",1+2=3,"Second is true","None are true")


The following line of code displays "None are true", which is the last result specified, because the first and second expressions evaluate to False (.F.).

? ICASE(1+2=2,"First is false",1+1=3,"Second is false","None are true")
回頂端
檢視會員個人資料 發送私人訊息
nelsonchuang



註冊時間: 2003-09-04
文章: 563
來自: 臺灣

第 9 樓

發表發表於: 星期二 十月 28, 2008 4:48 pm    文章主題: 引言回覆

請問一下,有沒有人透過odbc執行抓vfp表格?
會這樣子問,是因為我用odbc 去抓Vfp表格時,使用了Icase()這個式子,他告訴我file"icast.prg" does not esixt!

_________________
大家好,請多指教
回頂端
檢視會員個人資料 發送私人訊息
syntech



註冊時間: 2003-05-16
文章: 4211
來自: Taipei,Taiwan

第 10 樓

發表發表於: 星期二 十月 28, 2008 5:16 pm    文章主題: 引言回覆

1.ODBC 不是 VFP.

2. VFP ODBC DRIVER 只更新到 VFP6還VFP7的版本
VFP OLEDB DRIVER才更新到 VFP9

_________________
如果公司有下列困擾:
1. 找不到便宜,快速,簡易的 生產排程軟體
2. 不知道如何快速排定 採購計劃
3. 成本抓不準,自己算比軟體算有用
4. 想學習系統規劃,想找系統架構的顧問

請聯絡我們,也許我們幫得上忙
回頂端
檢視會員個人資料 發送私人訊息 發送電子郵件 AIM Address
nelsonchuang



註冊時間: 2003-09-04
文章: 563
來自: 臺灣

第 11 樓

發表發表於: 星期三 十月 29, 2008 8:37 am    文章主題: 引言回覆

原來我把ODBC 當VFP來用了,SORRY~
_________________
大家好,請多指教
回頂端
檢視會員個人資料 發送私人訊息
從之前的文章開始顯示:   
發表新主題   回覆主題    VFP 愛用者社區 首頁 -> SQL 討論區 所有的時間均為 台北時間 (GMT + 8 小時)
1頁(共1頁)

 
前往:  
無法 在這個版面發表文章
無法 在這個版面回覆文章
無法 在這個版面編輯文章
無法 在這個版面刪除文章
無法 在這個版面進行投票
無法 在這個版面附加檔案
無法 在這個版面下載檔案


Powered by phpBB © 2001, 2005 phpBB Group
正體中文語系由 phpbb-tw 維護製作