Zoque.Forum
»
MySQL'de bilgi güncellerken kullandığım SQL cümlesinde hata alıyorum.
|
| Veritabanları MySQL , MSSQL, SQL, Access, Oracle |
![]() |
|
|
LinkBack | Seçenekler |
|
|
#1 (permalink) |
|
Üyelik Tarihi: 28.05.2001
Yer: İzmir/Ankara
Yaş: 23
Mesaj: 766
|
MySQL'de bilgi güncellerken kullandığım SQL cümlesinde hata alıyorum.
tablo" tablosunda ad ları güncellemek ve her seferinde adları birleştirip tekrar ad alanına yazdırmak istiyorum şöyleki:
Örneğin ilk olarak tablonun ad alanında "canol" adı kayıtlı daha sonra ben bir değişkenle başka bir ad daha alıyorum degisken="tunc" ben simdi "ad" alanını "canol-tunc" diye güncellemek istiyorum alttaki cümleciği kullandım (aslında cümle biraz atmasyon oldu) ama hata verdi : sql_guncelle="update tablo set ad = #%ad%degisken%# where numara = 1;" not:#=tektırnak, %=& verdiği hata: [MySQL][ODBC 3.51 Driver][mysqld-3.23.47-nt]Unknown column degisken in field list |
|
|
|
|
|
#3 (permalink) |
|
Üyelik Tarihi: 06.07.2001
Yer: Ankara
Yaş: 33
Mesaj: 679
|
bende stNonStop gibi tam olarak anlamadım ama şu sorgu bu işi görür sanırsam.
UPDATE tablo SET ad = concat( ad, ' hede hödö', degisken ) denemeden önce temp bir tabloda test etmende fayda var. malum update sonra hede hödö yu kaldımaya uğraşmamak lazım.
__________________
uzaytek.com |
|
|
|
|
|
#5 (permalink) |
|
Üyelik Tarihi: 06.07.2001
Yer: Ankara
Yaş: 33
Mesaj: 679
|
concat stringleri birleştirmeye yarıyor.
bunun bir de concat_ws ile yazılan versiyonu var oda concat with separator oluyormuş; ilk parametresi separator diğerleri stringler şeklinde. MySQL manual de şöyle yazıyor. CONCAT(str1,str2,...) Returns the string that results from concatenating the arguments. Returns NULL if any argument is NULL. May have more than 2 arguments. A numeric argument is converted to the equivalent string form: MySQL> SELECT CONCAT('My', 'S', 'QL'); -> 'MySQL' MySQL> SELECT CONCAT('My', NULL, 'QL'); -> NULL MySQL> SELECT CONCAT(14.3); -> '14.3' CONCAT_WS(separator, str1, str2,...) CONCAT_WS() stands for CONCAT With Separator and is a special form of CONCAT(). The first argument is the separator for the rest of the arguments. The separator can be a string as well as the rest of the arguments. If the separator is NULL, the result will be NULL. The function will skip any NULLs and empty strings, after the separator argument. The separator will be added between the strings to be concatenated: MySQL> SELECT CONCAT_WS(",","First name","Second name","Last Name"); -> 'First name,Second name,Last Name' MySQL> SELECT CONCAT_WS(",","First name",NULL,"Last Name"); -> 'First name,Last Name'
__________________
uzaytek.com |
|
|
|
![]() |
| Etiketler |
| aliyorum , hata , cumlesinde , sql , kullandigim , guncellerken , bilgi , mysqlde |
|
|
Zoque'a hoşgeldiniz!