posts - 431,  comments - 344,  trackbacks - 0

          An INTERSECT is simply an inner join where we compare the tuples of one table with those of the other, and select those that appear in both while weeding out duplicates. So

          select id, username from user where id>1
          INTERSECT
          select id, username from user where id<3

          can simply be rewritten to

          select id, username from user inner join
          (select id, username from user where id <3) as b using (id, username)
          where id>1

          or
          select a.id, a.username from
          ((select id, username from user where id > 1) as a
          cross join
          (select id, username from user where id <3) as b  on a.id = b.id)
          posted on 2010-03-14 20:49 周銳 閱讀(310) 評論(0)  編輯  收藏 所屬分類: MySQL
          主站蜘蛛池模板: 颍上县| 金溪县| 额敏县| 当雄县| 永兴县| 瓦房店市| 镇原县| 南漳县| 襄汾县| 大田县| 宜丰县| 屏山县| 佛坪县| 寻甸| 佛教| 焉耆| 灵石县| 壶关县| 曲沃县| 鹤庆县| 那曲县| 孝感市| 土默特右旗| 昔阳县| 汨罗市| 山东省| 杂多县| 随州市| 辉南县| 隆子县| 洪泽县| 门源| 太仓市| 楚雄市| 胶南市| 政和县| 临武县| 乐山市| 揭西县| 台江县| 武鸣县|