MySQL: Select rows with more than one occurrence

前端 未结 2 1210
你的背包
你的背包 2020-12-24 14:25

Here\'s my query. It selects a list of ids from two tables across two databases. The query works fine.

select en.id, fp.blogid
from french.blog_pics fp, fren         


        
相关标签:
2条回答
  • 2020-12-24 14:47

    Use DISTINCT for avoiding multiple occurance

    0 讨论(0)
  • 2020-12-24 14:52
    select en.id, fp.blogid, count(*) as occurrences
    from french.blog_pics fp, french.blog_news fn, english.blog_news en 
    where fp.blogid = fn.id 
    and en.title_fr = fn.title 
    and fp.title != ''
    group by en.id
    having count(*) > 1
    
    0 讨论(0)
提交回复
热议问题