Ich habe 6 weitere Tabellen in MySQL und jedes Feld hat ein eindeutiges Feld 'Works_id', ich gebe Daten diese Tabelle ein. Ich möchte nur übereinstimmenden Wert es zeigt, aber es dauert 16 Zeilen. Angenommen, im Worker-Name-Feld zeigt es zwei Namen mit 8 Wiederholungen, aber ich möchte nur einmal zwei Namen. Es kann zwei Zeilen dauern. Aber wie es möglich ist. My Table Show:Wählen Sie nur übereinstimmenden Wert in Sql mit Codeigniter
Ser Works ID Date Of Works Infrastructure Name of System Type of Works Vendor Name Worker Name 1 1016 2017-03-12 Server JoinBDApps Trobleshooting Vintage IT Md Rajaon 2 1016 2017-03-12 Server JoinBDApps Software Upgrade Vintage IT Md Rajaon 3 1016 2017-03-12 Network JoinBDApps Trobleshooting Vintage IT Md Rajaon 4 1016 2017-03-12 Network JoinBDApps Software Upgrade Vintage IT Md Rajaon 5 1016 2017-03-12 Server CMH Trobleshooting Vintage IT Md Rajaon 6 1016 2017-03-12 Server CMH Software Upgrade Vintage IT Md Rajaon 7 1016 2017-03-12 Network CMH Trobleshooting Vintage IT Md Rajaon 8 1016 2017-03-12 Network CMH Software Upgrade Vintage IT Md Rajaon 9 1016 2017-03-12 Server JoinBDApps Trobleshooting GP IT Md Forkan 10 1016 2017-03-12 Server JoinBDApps Software Upgrade GP IT Md Forkan 11 1016 2017-03-12 Network JoinBDApps Trobleshooting GP IT Md Forkan 12 1016 2017-03-12 Network JoinBDApps Software Upgrade GP IT Md Forkan 13 1016 2017-03-12 Server CMH Trobleshooting GP IT Md Forkan 14 1016 2017-03-12 Server CMH Software Upgrade GP IT Md Forkan 15 1016 2017-03-12 Network CMH Trobleshooting GP IT Md Forkan 16 1016 2017-03-12 Network CMH Software Upgrade GP IT Md Forkan
Aber ich will:
Ser Works ID Date Of Works Infrastructure Name of System Type of Works Vendor Name Worker Name 1 1016 2017-03-12 Server JoinBDApps Trobleshooting Vintage IT Md Rajaon Network CMH Software Upgrade GP IT Md Forkan
Mein Codeigniter Modell ist:
$this->db->select('trxn_tbl.works_id, trxn_tbl.works_date, infrashtructure_txn_info.infrashtructure_name, apps_txn_tbl.apps_name, works_type_txn_tbl.works_type, workers_tbl.vendor_id, workers_tbl.name'); $this->db->from('infrashtructure_txn_info'); $this->db->join('workers_tbl', 'trxn_tbl.works_id = workers_tbl.works_id'); $this->db->join('works_type_txn_tbl', 'trxn_tbl.works_id = works_type_txn_tbl.works_id'); $this->db->join('infrashtructure_txn_info', 'trxn_tbl.works_id = infrashtructure_txn_info.works_id'); $this->db->join('apps_txn_tbl', 'trxn_tbl.works_id = apps_txn_tbl.works_id'); $query = $this->db->get(); return $query->result();
Bitte jemand mir helfen ...
Seine out Put auch gleich. Wie 16 Reihen .... –
add '$ this-> db-> group_by ('name_of_column');' nach '$ this-> db-> distinct()' Jetzt? –
Then Shows ...... Ausdruck # 1 der SELECT-Liste ist nicht in GROUP BY-Klausel und enthält nichtaggregierte Spalte 'dcapp_db.trxn_tbl.works_id', die nicht funktional von Spalten in der GROUP BY-Klausel abhängig ist; Dies ist inkompatibel mit sql_mode = only_full_group_by –