MySQL code is behaving different

(4 posts) (2 voices)

Tags:

No tags yet.

  1. SongezoM, Member

    Hi,

    Any idea why my code would work on MySQL Workbench and not on myDBR?


    select Name, Categories from (
    select concat_ws(', ', c.first_name, c.last_name) as 'Name', group_concat(name) as 'Categories'
    from contacts c
    inner join contacts_categories e on (e.contacts_categories_contacts_ida = c.id and e.deleted = 0)
    inner join categories o on (e.contacts_categories_categories_idb = o.id and o.deleted = 0)
    group by c.id) t
    where instr(Categories, (select group_concat(name) from categories where name in ('Cape','Financial Services','Management')))

    Thanks a lot in advance,
    Songezo

  2. myDBR Team, Key Master

    Could you tell what is the difference you are seeing?

    --
    myDBR Team

  3. SongezoM, Member

    The results in MySQL Workbench return only contacts with those exact categories and more
    e.g
    1.Jan, de Klerk Cape,Financial Services,Management
    2.Zeenat, Soeker Cape,Financial Services,Management,Software Quality Assurance,Retail

    but in myDBR it returns contacts where one or more of the categories are there, for example:
    1. Jazmyne, Yarlett Cape,DVT Potential,DVT Potential - Placements,Project Management
    2. Gerrit, van Dyk Asset Management,Broker Distribution,Content Management,Gauteng,Financial Services,CMS

    (using the list in the code above)

    Thanks a lot in advance,
    Songezo

  4. myDBR Team, Key Master

    Make sure you execute exactly the same query and parameters from both applications. MySQL will give you same result from same query, regardless of who is asking.

    --
    myDBR Team


Reply

You must log in to post.