我在mysql
的表中有一個名爲type
的列。含量低於在where子句中使用子字符串的正確方法mysql查詢
Type
Test 12
Test abc
start 1
start abcd
end 123
現在我想選擇記錄,其中type
開始與Test
預期結果:
Test 12
Test abc
但我正在逐漸要麼
測試12 或空的結果
我試圖象下面這樣:
select * from table where type = 'Test 12'
select * from table where type = '%Test%'
select * from table where type = '%Test'
什麼應該是正確sql
聲明。
%測試** **結束與測試,而不是與它開始。 –
@JacquesAmar更正。 – tadman