Jump to content

Showing Duplicate records in mysql query


suhaib1122

Recommended Posts

 

 

I have a table name tblnetworkstatus and I have 11 columns

 

    Id

    issue_name

    affected_server

    affected_service

    issue_type

    priority

    duration

    status

    start_date

    end_date

    description

 

I am getting id in affected_server and affected_service which I am storing in my DB, now I have three situations

 

    Either both affected_server and affected_service has been selected

    Only affected_server is selected

    Only affected_service is selected

 

I am getting the name of affected_server and affected_service from tblserver and tblproducts respectively using join on three tables tblnetworkstatus,tblserver and tblproduct I already have the following query got from here

 

    SELECT 

        m.issue_name ,m.issue_type ,

        m.priority ,m.status,m.description ,

        m.start_date,m.end_date,m.duration,

        s.name  as server_name,p.name as product_name

        from mod_networkstatus as m 

        LEFT JOIN  tblservers as  s  ON  FIND_IN_SET(s.id,m.affected_server)

        LEFT JOIN tblproducts as  p  ON  FIND_IN_SET(p.id,m.affected_service)

 

 

 

But If I have multiple id's of affected_server and affected_service like I am storing 1,2,3,4 in a single column affected_server or affected_service and I am getting the record duplicate instead only the affected_server or affetced_service is different in that which I don't want I want to show these in a single coulmn field after retrieving like stroing 1,2,3,4  then how can I do that?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.