kschmelzer
Benutzer
- Beiträge
- 5
Guten Morgen zusammen,
ich bin recht neu in dem Thema und arbeite gerade an folgender MYSQL Abfrage.
Leider bekomme ich mit dem Befehl "Group by" partou nicht die Zeilen zu einer zusammengeführt (es sollen alle Werte zu einer Auftragsnummer in einer Zeile zusammengefasst werden).
Vielleicht kann mir da jemand von euch weiterhelfen?
Vielen Dank im Voraus.
ich bin recht neu in dem Thema und arbeite gerade an folgender MYSQL Abfrage.
Leider bekomme ich mit dem Befehl "Group by" partou nicht die Zeilen zu einer zusammengeführt (es sollen alle Werte zu einer Auftragsnummer in einer Zeile zusammengefasst werden).
Vielleicht kann mir da jemand von euch weiterhelfen?
Vielen Dank im Voraus.
Code:
SELECT
T1.code AS Auftragsnummer,
T1.description AS Bezeichnung,
(CASE WHEN T4.code = 'NEU' AND T5.code = 'WZG' AND (T2.code = 'N' OR T2.code = 'E') THEN T6.int_id END) AS 'N-E Neu WZG',
(CASE WHEN T4.code = 'NEU' AND T5.code = 'KAL' AND (T2.code = 'N' OR T2.code = 'E') THEN T6.int_id END) AS 'N-E Neu KAL',
(CASE WHEN T4.code = 'NEU' AND T5.code = 'TPL' AND (T2.code = 'N' OR T2.code = 'E') THEN T6.int_id END) AS 'N-E Neu TPL',
(CASE WHEN T4.code = 'VT' AND T5.code like '%WZG' AND (T2.code = 'N' OR T2.code = 'E') THEN T6.int_id END) AS 'N-E VT WZG',
(CASE WHEN T4.code = 'VT' AND T5.code like '%KAL' AND (T2.code = 'N' OR T2.code = 'E') THEN T6.int_id END) AS 'N-E VT KAL',
(CASE WHEN T4.code = 'VT' AND T5.code like '%TPL' AND (T2.code = 'N' OR T2.code = 'E') THEN T6.int_id END) AS 'N-E VT TPL',
(CASE WHEN T4.code = 'ZA' AND T5.code like '%WZG' AND (T2.code = 'N' OR T2.code = 'E') THEN T6.int_id END) AS 'N-E ZA WZG',
(CASE WHEN T4.code = 'ZA' AND T5.code like '%KAL' AND (T2.code = 'N' OR T2.code = 'E') THEN T6.int_id END) AS 'N-E ZA KAL',
(CASE WHEN T4.code = 'ZA' AND T5.code like '%TPL' AND (T2.code = 'N' OR T2.code = 'E') THEN T6.int_id END) AS 'N-E ZA TPL',
(CASE WHEN T4.code = 'VT' AND T5.code like '%WZG' AND T2.code = 'P' THEN T6.int_id END) AS 'P VT WZG',
(CASE WHEN T4.code = 'VT' AND T5.code like '%KAL' AND T2.code = 'P' THEN T6.int_id END) AS 'P VT KAL',
(CASE WHEN T4.code = 'VT' AND T5.code like '%TPL' AND T2.code = 'P' THEN T6.int_id END) AS 'P VT TPL',
(CASE WHEN T4.code = 'VT' AND T5.code like '%WZG' AND T2.code = 'F' THEN T6.int_id END) AS 'F VT WZG',
(CASE WHEN T4.code = 'VT' AND T5.code like '%KAL' AND T2.code = 'F' THEN T6.int_id END) AS 'F VT KAL',
(CASE WHEN T4.code = 'VT' AND T5.code like '%TPL' AND T2.code = 'F' THEN T6.int_id END) AS 'F VT TPL'
FROM
job AS T1
JOIN
index_job AS T2 ON T1.int_id=T2.job_id
JOIN
line_job AS T3 ON T2.int_id=T3.index_job_id
JOIN
assembly AS T4 ON T3.int_id=T4.line_job_id
JOIN
assembly AS T5 ON T4.int_id=T5.assembly_id
JOIN
task AS T6 ON T5.int_id=T6.assembly_id
WHERE
T1.int_id > 0 AND
T6.description = 'CNC-Fräsen'