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?

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.