0
我有兩個表,donaTypes
和fullInfo
。mysql連接得不到迴應
fullInfo
:
id funddesc giftamt giftdate
001 annual fund 50.00 2010-03-09
223 alumni fund 25.00 2009-03-06
334 capital exp 100.00 2011-09-27
... ... ... ...
donaTypes
:
id donaType
1 annual fund
2 capital exp
3 alumni fund
我試圖用插入donaTypes.id
數到fullInfo
表的希望相匹配,其中fullInfo.funddesc = donaTypes.donaType
。這裏是我的代碼,但我只是得到了一個空白響應(沒有錯誤):
SELECT st1.funddesc, st2.donatype
FROM
(select t1.funddesc
from fullInfo as t1) st1
inner join
(select t2.donatype
from donatTypes as t2) st2
on trim(st1.funddesc) like trim(st2.donaType)
;
我也試過:
SELECT t1.funddesc, t2.donatype
FROM fullInfo as t1,
donatTypes as t2
where trim(t1.funddesc) = trim(t2.donatype);
理想情況下,我想fullInfo
看起來像這樣:
fullInfo
:
id funddesc giftamt giftdate
001 1 50.00 2010-03-09
223 3 25.00 2009-03-06
334 2 100.00 2011-09-27
... ... ... ...
您是否驗證過funddesc和donatype之間的數據類型是否相同? –
應該工作,數據類型和相同。是否可能存在一些不可見字符(例如CR/LF)。我建議從每個表格中獲取兩個字段的長度(),以確保文本包含您的想法。 – Sparky
是的,它們都是varchar。 – screechOwl