动态下拉更新基于另一个下拉列表

时间:2018-03-15 17:16:41

标签: mysql sql

我有三次下拉。类别,性别,分部。我可以选择任何组合或单一

Category                  Gender         Division
Athletic                  Men              AP
Baseball                  Women             AR

想要更新专栏

Description
Atheltic-Men-AP (or)
Men(or)
AP(or)
Atheltic-AP(or)
Men-AP`

更新table_name set?

目前我正在使用此代码

                 if (!string.IsNullOrEmpty(this.comboBoxCategory.Text))
                    decriptionGroup = this.comboBoxCategory.Text + " ";

                if (!string.IsNullOrEmpty(this.comboBoxDept.Text))
                    decriptionGroup += this.comboBoxDept.Text + " ";

                if (!string.IsNullOrEmpty(this.comboBoxDivision.Text))
                    decriptionGroup += this.comboBoxDivision.Text;    


UPDATE  table_Name  SET  Category_Desc ='" + decriptionGroup + @"'  

SELECT  Category_Desc AS [Description]  FROM table_Name

从这段代码我需要选择没有类别的类别,这是一个错误的错误

1 个答案:

答案 0 :(得分:0)

         IF NOT EXISTS (SELECT * FROM TempDB.INFORMATION_SCHEMA.COLUMNS 
   WHERE COLUMN_NAME = ''category_desc'' AND TABLE_NAME LIKE '#Doors_2%'')
                     ALTER TABLE #Doors_2 ADD category_desc NVARCHAR(50) 

  UPDATE  table_Name  SET  Category_Desc ='" +  decriptionGroup + @"'  
                      ;WITH CLSDOORS2 AS
                       (
                       SELECT Style_Color, category_desc AS [Description], 
                  Store_ID, Cluster_Index, Total_Avg FROM #Cluster_Vlm_Doors_2
                       )
                       SELECT * FROM CLSDOORS2 '