【问题标题】:mySQL: SELECT with reference to another table w/o JOINmySQL:SELECT 参考另一个没有 JOIN 的表
【发布时间】:2016-12-27 09:31:31
【问题描述】:

在 MS Access 中,我有一个类似的查询

SELECT t1.*
FROM t1, t2
WHERE (((t1.c1) Like t2.c1));

在 t1.c1 我有 e。 g.

"head of marketing"
"head of sales"
"software developer"
...

在 t2.c1 我有 e。 g.

" 'asterisk' head of 'asterisk' " (with "*" as placeholders in front and after the search term).

当我运行查询时,我得到了

"head of marketing"
"head of sales"

因此它工作得很好。

我从 MS Access 切换到了 mySQL。那里的语句不返回结果 - 只有完全匹配。

如何在原生 mySQL 中重现 SQL 语句?

服务器版本:5.6.32-78.1-log Protokoll 版本:10

【问题讨论】:

  • 很难理解星号的含义。似乎您可能正在与 Markdown 格式作斗争并对此进行补偿?要格式化代码并避免意外获得粗体文本,请突出显示代码块或内联代码并使用{} 编辑器工具栏按钮或ctrl-k

标签: mysql select join where placeholder


【解决方案1】:

Access 中的星号似乎是通配符。

在包括 MySQL 在内的大多数 SQL 方言中,通配符是 '%' 来匹配字符序列,而不是 *

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-08
    • 2018-02-13
    相关资源
    最近更新 更多