有沒有辦法做到爲開始,但可能無法完全包含一個給定的字符串數據字段MySQL查詢?的MySQL查詢「開頭,但不能完全包含」
舉例來說,如果我有數據項的以下列表:
my_table
1. example.com
2. example.com/subpage
3. subdomain.example.com
4. ain.example.com
5. ple.com
我想喂
- 「example.com/subpage」,回到#1,#2
- 「example.com」,回到#1
- 「wexample.com」 不返回任何
- 「EXA」 不返回任何
- 「subdomain.example.com/subpage」,返回3號
非常感謝!
太棒了!我需要在大型數據集上運行它,並且經常使用它:)但這是有效的。 – Kyle 2011-03-07 03:13:21
當我還是學生的時候,在哪裏是stackoverflow:/ – Dimitry 2011-03-07 03:13:59
哦,這個問題不是作業。我已經收到了很多東西。一定是我青春活力。 :) – Kyle 2011-03-07 03:16:10