sql - rails union hack, how to pull two different queries together -


I have a query that searches two different areas in the same table ... looking for places That is a specific city, but it can also be a country ... i.e. two areas are needed.

The table looks:

  Country of the city Germany Aachen USA USA Amérillo USA Austin  

Result:

  Keyword SIDINFO Aachen Germany USA USA ASTRINA USA Germany Country Originally I am thinking that if there is more to do this, there is a brief way to do this because I had to use two different questions, then add them together, Sort, etc. (Which works fine):  
  def self.ajax (search) countries = location country, es sidoinfo ',: joins = & gt; hotels, conditions = & gt; [' hotels. Not a match and the country does not like? ', #' {Search}% "],: group = & gt;: country) cities = location. (But not all:: Select => Key words as city, Country AS sideinfo ',: Hotels = & gt;: Hotels, Hotels, Hotels & Accommodation, Hotels & Accommodation, Hotels & Accommodation, Country out = out.sort {| a, b | | Akeyword & lt; = & gt; B.keyword} out.first (8) end  

Unions who use ActiveRecord No information was found about ...

querying a union possibly with a secure record There are two solutions:

  • You want to use it to create your query. I do not recommend it.
  • Using a plugin Such as the Union SQL query.

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -