DROP VIEW "public"."material_search_view";--> statement-breakpoint
ALTER TABLE "biddings" ADD COLUMN "ANFNR" varchar(50);--> statement-breakpoint
CREATE VIEW "public"."material_search_view" AS (select "mdg"."MATERIAL_MASTER_PART_MATL"."MATKL" as "material_group_code", "mdg"."MATERIAL_MASTER_PART_MATL_CHARASGN"."ATWTB" as "material_group_desc", COALESCE("mdg"."MATERIAL_MASTER_PART_MATL"."MATKL", '') || ' - ' || COALESCE("mdg"."MATERIAL_MASTER_PART_MATL_CHARASGN"."ATWTB", '') as "display_text" from "mdg"."MATERIAL_MASTER_PART_MATL" inner join "mdg"."MATERIAL_MASTER_PART_MATL_CHARASGN" on "mdg"."MATERIAL_MASTER_PART_MATL"."MATNR" = "mdg"."MATERIAL_MASTER_PART_MATL_CHARASGN"."MATNR" where 
      "mdg"."MATERIAL_MASTER_PART_MATL"."MATKL" IS NOT NULL 
      AND "mdg"."MATERIAL_MASTER_PART_MATL"."MATKL" != ''
      AND "mdg"."MATERIAL_MASTER_PART_MATL_CHARASGN"."ATWTB" IS NOT NULL 
      AND "mdg"."MATERIAL_MASTER_PART_MATL_CHARASGN"."ATWTB" != ''
     group by "mdg"."MATERIAL_MASTER_PART_MATL"."MATKL", "mdg"."MATERIAL_MASTER_PART_MATL_CHARASGN"."ATWTB" order by "mdg"."MATERIAL_MASTER_PART_MATL"."MATKL", "mdg"."MATERIAL_MASTER_PART_MATL_CHARASGN"."ATWTB");