Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想选择所有行,其中列 g_folder 存在于搜索词的开头。例如: 表 c_groups 中的一个元素是“/f1”(在 g_folder 列中)。所以我只想拥有搜索词开头的项目:
它应该看起来像:g_folder% is like '/f1/xx'; 但我不能把这个百分比放在变量后面。我怎样才能做到这一点?
g_folder% is like '/f1/xx';
我的声明:
select count(*) from c_groups where g_folder is like '/f1/xx'
如果这是 SQL Server,您可以像这样连接列:
SELECT COUNT(*) FROM c_groups WHERE '/f1/xx' LIKE (g_folder + '%')