Skip to Content
author's profile photo Former Member
Former Member

How to get the product models from two different catalog IDs having common product codes using flexible query?

Hi Experts,

I want to write a query to fetch the product models belonging in two different catalogs but having same product codes.

Any help would be appreciated !

Thanks,

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Posted on Jun 21, 2019 at 10:19 AM

    hi pratik, you can use IN and groupby clause. please find below query for refernece select {code},count({code}) from {product} where {catalog} in (catalog1 pk,catalog2 pk and so on..) group by {code}

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 21, 2019 at 01:20 PM

    Here is a query you can try out to get the result

    select {p.code}, {cv.version}, {c.id} from {Product as p}, {CatalogVersion as cv}, {Catalog as c} where {p.catalogVersion} = {cv.pk} and {cv.catalog} = {c.pk} and {p.code} = 'your_common_product_code'

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 21, 2019 at 02:04 PM

    select {code} from {Product} where {catalogVersion}='8796125989417' AND IN ({{select {code} from {Product} where {catalogVersion}='8746575588799'}})

    8796125989417 Pk of catalogVersion 1

    8746575588799 Pk of catalogVersion 2

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.