COGNOS QUERY STRUCTURE,1,1 DATABASE,GC_LOCOSOFT DATASOURCENAME,C:\GlobalCube\System\LOCOSOFT\IQD\serv_teile\offene_Auftraege_Teile.imr TITLE,offene_Auftraege_Teile.imr BEGIN SQL select distinct c55 as c1, c96 as c2, '' as c3, c95 as c4, c94 as c5, c93 as c6, c92 as c7, c91 as c8, c90 as c9, c89 as c10, c88 as c11, c87 as c12, c86 as c13, c85 as c14, c84 as c15, c83 as c16, c82 as c17, c81 as c18, c80 as c19, c79 as c20, '' as c21, '' as c22, '1' as c23, c78 as c24, c77 as c25, c76 as c26, 'Teile' as c27, c75 as c28, c74 as c29, c73 as c30, c72 as c31, c71 as c32, c70 as c33, c69 as c34, c68 as c35, c67 as c36, 'Service' as c37, c66 as c38, c65 as c39, c65 as c40, c64 as c41, c63 as c42, 1 as c43, XCOUNT('' for c55) as c44, c62 as c45, c61 as c46, c60 as c47, c59 as c48, c56 as c49, c58 as c50, c57 as c51, c56 as c52 from (select T1."order_number" as c55, T2."sum" as c56, T2."text_line" as c57, T2."parts_type" as c58, T2."amount" as c59, T2."stock_removal_date" as c60, T2."stock_no" as c61, T2."part_number" as c62, (od_left((ucase(T7."description")),3)) as c63, T7."description" as c64, T6."description" as c65, T6."make_number" as c66, T5."make_number" as c67, T5."license_plate" as c68, T5."vin" as c69, T5."internal_number" as c70, CASE WHEN (T5."license_plate" IS NOT NULL) THEN ((od_left((cast_numberToString(cast_integer(T1."order_number"))),6)) || ' - ' || (CASE WHEN (T1."order_taking_employee_no" = 0) THEN ('SB fehlt') ELSE ((od_left((cast_numberToString(cast_integer(T1."order_taking_employee_no"))),4)) || ' - ' || T3."name") END) || ' - ' || T4."family_name" || ' - ' || (asciiz(extract(YEAR FROM T1."order_date"),4) || '-' || asciiz(extract(MONTH FROM T1."order_date"),2) || '-' || asciiz(extract(DAY FROM T1."order_date"),2)) || ' - ' || T5."license_plate") ELSE ((od_left((cast_numberToString(cast_integer(T1."order_number"))),6)) || ' - ' || (CASE WHEN (T1."order_taking_employee_no" = 0) THEN ('SB fehlt') ELSE ((od_left((cast_numberToString(cast_integer(T1."order_taking_employee_no"))),4)) || ' - ' || T3."name") END) || ' - ' || T4."family_name" || ' - ' || (asciiz(extract(YEAR FROM T1."order_date"),4) || '-' || asciiz(extract(MONTH FROM T1."order_date"),2) || '-' || asciiz(extract(DAY FROM T1."order_date"),2))) END as c71, (od_left((cast_numberToString(cast_integer(T4."customer_number"))),7)) || ' - ' || T4."first_name" || ' ' || T4."family_name" as c72, T4."family_name" as c73, T4."first_name" as c74, T4."customer_number" as c75, CASE WHEN (T1."order_taking_employee_no" = 0) THEN ('SB fehlt') ELSE ((od_left((cast_numberToString(cast_integer(T1."order_taking_employee_no"))),4)) || ' - ' || T3."name") END as c76, T3."name" as c77, (cast_numberToString(cast_integer(T1."subsidiary"))) as c78, T1."clearing_delay_type" as c79, T1."parts_rebate_group_sell" as c80, T1."holder_number" as c81, T1."paying_customer" as c82, T1."order_customer" as c83, T1."order_mileage" as c84, T1."vehicle_number" as c85, T1."order_delivery_employee_no" as c86, T1."order_taking_employee_no" as c87, T1."order_print_date" as c88, T1."estimated_outbound_time" as c89, T1."estimated_inbound_time" as c90, T1."order_date" as c91, T2."invoice_number" as c92, T2."invoice_type" as c93, T2."is_invoiced" as c94, T1."subsidiary" as c95, T2."order_position" as c96 from (((((("dbo"."order_positions" T1 left outer join "dbo"."parts" T2 on T1."order_number" = T2."order_number") left outer join "dbo"."employees" T3 on T1."order_taking_employee_no" = T3."employee_number") left outer join "dbo"."customers_suppliers" T4 on T1."order_customer" = T4."customer_number") left outer join "dbo"."vehicles" T5 on T1."vehicle_number" = T5."internal_number") left outer join "dbo"."makes" T6 on T5."make_number" = T6."make_number") left outer join "dbo"."models" T7 on (T5."make_number" = T7."make_number") and (T5."model_code" = T7."model_code")) where ((((T2."invoice_number" IS NULL) and (T1."order_date" >= TIMESTAMP '2017-01-01 00:00:00.000')) and (T2."sum" IS NOT NULL)) and ('' <> 'F')) ) D1 order by c1 asc END SQL COLUMN,0,Order Number_ori COLUMN,1,Order Position COLUMN,2,Labour Type COLUMN,3,Subsidiary COLUMN,4,Is Invoiced COLUMN,5,Invoice Type COLUMN,6,Invoice Number COLUMN,7,Order Date COLUMN,8,Estimated Inbound Time COLUMN,9,Estimated Outbound Time COLUMN,10,Order Print Date COLUMN,11,Order Taking Employee No COLUMN,12,Order Delivery Employee No COLUMN,13,Vehicle Number COLUMN,14,Order Mileage COLUMN,15,Order Customer COLUMN,16,Paying Customer COLUMN,17,Holder Number COLUMN,18,Parts Rebate Group Sell COLUMN,19,Clearing Delay Type COLUMN,20,Code_Labour_Type COLUMN,21,Description_Labour_Type COLUMN,22,Hauptbetrieb COLUMN,23,Standort COLUMN,24,Name_Serviceberater COLUMN,25,Serviceberater COLUMN,26,Umsatzart COLUMN,27,Customer Number_Cust COLUMN,28,First Name_Cust COLUMN,29,Family Name_Cust COLUMN,30,Kunde COLUMN,31,Order Number COLUMN,32,Internal Number_Vehicle COLUMN,33,Vin_Vehicle COLUMN,34,License Plate_Vehicle COLUMN,35,Make Number_Vehicle COLUMN,36,Auftragsart COLUMN,37,Make Number_Makes COLUMN,38,Description_Makes COLUMN,39,Fabrikat COLUMN,40,Description_Models COLUMN,41,Model COLUMN,42,DG_1 COLUMN,43,DG_2 COLUMN,44,Part Number COLUMN,45,Stock No COLUMN,46,Stock Removal Date COLUMN,47,Amount COLUMN,48,Sum COLUMN,49,Parts Type COLUMN,50,Text Line COLUMN,51,Teile