【问题标题】:Mysql query to find out which id is having both french and germanMysql查询找出哪个ID同时具有法语和德语
【发布时间】:2015-04-24 16:06:42
【问题描述】:

查询哪个 id 同时具有法语和德语两种语言的查询是什么?

【问题讨论】:

  • 对于什么是“id”似乎存在根本性的误解。
  • 让我们退后一步 - 您想要完成什么(在更高级别)?
  • @Juhana 这些是学生证

标签: mysql


【解决方案1】:

你可以使用这个语句:

SELECT id
FROM st 
where name in ('german','french')
Group by id
having Count(*)=2

您应该在student_id 中重命名id

【讨论】:

    【解决方案2】:

    你可以这样做:

    SELECT st1.id
    FROM st as st1 
    JOIN st as st2 ON st1.id=st2.id AND st2.sname='german'
    WHERE st1.sname='french'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-22
      相关资源
      最近更新 更多