mysql query with AND, OR and NOT

后端 未结 3 1302
鱼传尺愫
鱼传尺愫 2021-01-02 22:59

Lets say I have a table of articles with as many to many relationship with topics. Each topic assigned to an article has a type field which can contain 1 of 3 v

3条回答
  •  生来不讨喜
    2021-01-02 23:32

    If I get this correctly

        SELECT * FROM ArticleTopics where type = 'AND'
    UNION
        SELECT * FROM ArticleTopics where type = 'OR' limit 1
    

    I assume by 'any' you mean 'any one'. You can join the articles to topics yourself, that's trivial.

提交回复
热议问题