Hi,



I am using sunspot solr for search i which i need to write query
for following mysql query

select sp.id as id,sp.upc, IF(spu.id IS NULL, p.name, spu.name) as
name, IF(spu.id IS NULL, m2.name, m1.name) manufacturer_name,
IF(spu.id IS NULL, b2.name, b1.name) brand_name,sp.store_id,IF(spu.id
IS NULL, spu.manufacturer_id, p.manufacturer_id) as
manufacturer_id,IF(spu.id IS NULL, spu.brand_id, p.brand_id) as
brand_id,sp.aisle_no,sp.aisle_side_id,sp.section_aisle,sp.shelf_number
from sal_products sp
LEFT JOIN store_product_upcs spu on (spu.upc = sp.upc and
spu.store_id = sp.store_id)
LEFT JOIN manufacturer m1 on (spu.manufacturer_id =
m1.manufacturer_id)
LEFT JOIN product p on (p.upc = sp.upc)
LEFT JOIN manufacturer m2 on (p.manufacturer_id =
m2.manufacturer_id)
LEFT JOIN brand b1 on (spu.brand_id = b1.brand_id)
LEFT JOIN brand b2 on (p.brand_id = b2.brand_id) group by
sp.upc


could any one provide me solution?

thanks,
-pab

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Matt Jones at Feb 19, 2012 at 12:18 am

    On Feb 17, 6:26 am, Pab wrote:
    Hi,

    I am  using sunspot solr for search i which i need to write query
    for following mysql query

    select  sp.id as id,sp.upc, IF(spu.id IS NULL, p.name, spu.name) as
    name, IF(spu.id IS NULL, m2.name, m1.name) manufacturer_name,
    IF(spu.id IS NULL, b2.name, b1.name) brand_name,sp.store_id,IF(spu.id
    IS NULL, spu.manufacturer_id, p.manufacturer_id) as
    manufacturer_id,IF(spu.id IS NULL, spu.brand_id, p.brand_id) as
    brand_id,sp.aisle_no,sp.aisle_side_id,sp.section_aisle,sp.shelf_number
    from sal_products sp
    LEFT JOIN store_product_upcs spu on (spu.upc = sp.upc and
    spu.store_id = sp.store_id)
    LEFT JOIN manufacturer m1 on (spu.manufacturer_id =
    m1.manufacturer_id)
    LEFT JOIN product p on (p.upc = sp.upc)
    LEFT JOIN manufacturer m2 on (p.manufacturer_id =
    m2.manufacturer_id)
    LEFT JOIN brand b1 on (spu.brand_id = b1.brand_id)
    LEFT JOIN brand b2 on (p.brand_id = b2.brand_id) group by
    sp.upc

    could any one provide me solution?
    No, nobody is going to be able to provide you a solution when you've
    provided *no* information about how the data is stored in Solr...

    --Matt Jones

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedFeb 17, '12 at 12:26p
activeFeb 19, '12 at 12:18a
posts2
users2
websiterubyonrails.org
irc#RubyOnRails

2 users in discussion

Matt Jones: 1 post Pab: 1 post

People

Translate

site design / logo © 2021 Grokbase