【问题标题】:How to convert SQL to Arel?如何将 SQL 转换为 Arel?
【发布时间】:2011-04-07 10:27:57
【问题描述】:

有没有办法将MATCHAGAINST 部分转换为Arel

我在 Arel 源代码中找不到任何关于它的信息。

我正在使用 Rails 3。

SELECT gigs.time, gigs.channel_id, gigs.song_id, gigs.id, 
  MATCH (songs.title) AGAINST (?) AS song_score,
  MATCH (artists.name) AGAINST (?) AS artist_score
  FROM songs
  INNER JOIN artists ON artists.id = songs.artist_id
  INNER JOIN gigs ON gigs.song_id = songs.id
  WHERE MATCH (artists.name) AGAINST (?) OR
  MATCH (songs.title) AGAINST (?)
  HAVING (artist_score + song_score) > 0

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 arel


    【解决方案1】:

    AFAIK 没有 Arel MATCH AGAINST 实现。我的猜测是因为它不是纯 SQL,而是 MySQL 特有的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-21
      • 2021-11-27
      • 2012-11-05
      • 2013-09-23
      相关资源
      最近更新 更多