全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1480
推到 Plurk!
推到 Facebook!

關於MySQL小分號疑問?

答題得分者是:Justmade
ko
資深會員


發表:28
回覆:785
積分:444
註冊:2002-08-14

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-03-18 16:01:10 IP:61.221.xxx.xxx 未訂閱
不知有沒有MySQL資料庫高手或經驗老道的先輩可以幫幫迷途中的小肥羊嗎? 問題如下: 1.在phpmyadmin的環境下想下一段sql指令   update tableA set a_title='Tom's house' where a_id=1   這樣會錯誤   原因是a_title='Tom's house' 有一個小分號 請問各位大大如何是好!!!! 2.在MySQL中將2個欄位相加??? update tableA set a_title=a_memo a_title where a_id=1 原來a_title存的值是Toms house a_memo存的值是Welcome 這樣原來的a_title因該會變成Welcome Toms house 可是代誌不是憨人所想的這麼簡單!! 小弟試了一下發現a_title變成0 請問各位大大如何是好!!!! < >< >
------
======================
昏睡~
不昏睡~
不由昏睡~
Justmade
版主


發表:94
回覆:1934
積分:2030
註冊:2003-03-12

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-03-18 16:50:24 IP:218.16.xxx.xxx 未訂閱
1.  update tableA set a_title='Tom\'s house' where a_id=1 or update tableA set a_title="Tom's house" where a_id=1 2. update tableA set a_title=CONCAT(a_memo, ' ', a_title) where a_id=1
ko
資深會員


發表:28
回覆:785
積分:444
註冊:2002-08-14

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-03-18 17:27:44 IP:61.221.xxx.xxx 未訂閱
毆喔!!    
引言: 2.在MySQL中將2個欄位相加??? update tableA set a_title=a_memo a_title where a_id=1 原來a_title存的值是Toms house a_memo存的值是Welcome
小弟忘了問這個問題還有第2小題就是如何在a_title=a_memo a_title 的時候 在memo與title中間加上斷行就是 類似按下enter鍵
------
======================
昏睡~
不昏睡~
不由昏睡~
Justmade
版主


發表:94
回覆:1934
積分:2030
註冊:2003-03-12

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-03-18 18:20:39 IP:218.16.xxx.xxx 未訂閱
Linex / Unix / Mac : update tableA set a_title=CONCAT(a_memo, '/n', a_title) where a_id=1 PC : update tableA set a_title=CONCAT(a_memo, '/n/r', a_title) where a_id=1
timhuang
尊榮會員


發表:78
回覆:1815
積分:1608
註冊:2002-07-15

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-03-18 23:25:17 IP:61.221.xxx.xxx 未訂閱
引言: Linex / Unix / Mac : update tableA set a_title=CONCAT(a_memo, '/n', a_title) where a_id=1 PC : update tableA set a_title=CONCAT(a_memo, '/n/r', a_title) where a_id=1
justmade 兄可能一時筆誤. 應該是 \n, 及 \n\r 另外補充一下. 你可以下載 mysql 的官方 help 檔. 在 http://www.mysql.com/documentation/index.html 選適合你用的. 個人建議是 使用 chm 或 hlp 檔都不錯. 另外單引號除了可用 \' 以外, 也可以像 mssql 一樣使用 '' (兩個單引號) 來使用!! 以下為幾種特殊符號: \0 An ASCII 0 (NUL) character. \' A single quote (`'') character. \" A double quote (`"') character. \b A backspace character. \n A newline character. \r A carriage return character. \t A tab character. \z ASCII(26) (Control-Z). This character can be encoded to allow you to work around the problem that ASCII(26) stands for END-OF-FILE on Windows. (ASCII(26) will cause problems if you try to use mysql database < filename.) \\ A backslash (`\') character. \% A `%' character. This is used to search for literal instances of `%' in contexts where `%' would otherwise be interpreted as a wildcard character. \_ A `_' character. This is used to search for literal instances of `_' in contexts where `_' would otherwise be interpreted as a wildcard character. Note that if you use `\%' or `\_' in some string contexts, these will return the strings `\%' and `\_' and not `%' and `_'.
ko
資深會員


發表:28
回覆:785
積分:444
註冊:2002-08-14

發送簡訊給我
#6 引用回覆 回覆 發表時間:2003-03-19 10:38:03 IP:61.221.xxx.xxx 未訂閱
真是太感謝!! 小弟已經可以維護了!! 阿里阿豆!!!
------
======================
昏睡~
不昏睡~
不由昏睡~
系統時間:2024-06-28 17:50:14
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!