查询使用查询获取mysql记录

时间:2018-01-17 00:57:50

标签: mysql

我创建了一个表格,如下所示

                CREATE TABLE IF NOT EXISTS order_det
        ( order_id INT(4) UNSIGNED ZEROFILL NOT NULL AUTO_INCREMENT,
         Cust_name_1 CHAR(20) DEFAULT '' NOT NULL,
        P_desc_1 CHAR(20) DEFAULT '' NOT NULL,
        Drawing_num_1 CHAR(20) DEFAULT '' NOT NULL,
        Material_1 CHAR(20) DEFAULT '' NOT NULL,
         Operation_1 CHAR(20) DEFAULT '' NOT NULL,
         Quantity_1 INT(4) UNSIGNED ZEROFILL NOT NULL DEFAULT 0,
         date_1 CHAR(20) DEFAULT '' NOT NULL,
          Cust_name_2 CHAR(20) DEFAULT '' NOT NULL,
         P_desc_2 CHAR(20) DEFAULT '' NOT NULL,
        Drawing_num_2 CHAR(20) DEFAULT '' NOT NULL,
        Material_2 CHAR(20) DEFAULT '' NOT NULL,
         Operation_2 CHAR(20) DEFAULT '' NOT NULL ,
         Quantity_2 INT(4) UNSIGNED ZEROFILL NOT NULL DEFAULT 0,
         date_2 CHAR(20) DEFAULT '' NOT NULL,
         Cust_name_3 CHAR(20) DEFAULT '' NOT NULL,
         P_desc_3 CHAR(20) DEFAULT '' NOT NULL,
        Drawing_num_3 CHAR(20) DEFAULT '' NOT NULL,
        Material_3 CHAR(20) DEFAULT '' NOT NULL,
         Operation_3 CHAR(20) DEFAULT '' NOT NULL,
         Quantity_3 INT(4) UNSIGNED ZEROFILL NOT NULL DEFAULT 0,
         date_3 CHAR(20) DEFAULT '' NOT NULL,
         Cust_name_4 CHAR(20) DEFAULT '' NOT NULL,
         P_desc_4 CHAR(20) DEFAULT '' NOT NULL,
        Drawing_num_4 CHAR(20) DEFAULT '' NOT NULL,
        Material_4 CHAR(20) DEFAULT '' NOT NULL,
         Operation_4 CHAR(20) DEFAULT '' NOT NULL,
         Quantity_4 INT(4) UNSIGNED ZEROFILL NOT NULL DEFAULT 0,
         date_4 CHAR(20) DEFAULT '' NOT NULL,
         Cust_name_5 CHAR(20) DEFAULT '' NOT NULL,
         P_desc_5 CHAR(20) DEFAULT '' NOT NULL,
        Drawing_num_5 CHAR(20) DEFAULT '' NOT NULL,
        Material_5 CHAR(20) DEFAULT '' NOT NULL,
         Operation_5 CHAR(20) DEFAULT '' NOT NULL,
         Quantity_5 INT(4) UNSIGNED ZEROFILL NOT NULL DEFAULT 0,
         date_5 CHAR(20) DEFAULT '' NOT NULL,
        PRIMARY KEY(order_id))

表中有条目。 当我给予

            SELECT * FROM order_det;

它可以正常运行image_1中显示的结果。image_1

然而,当我给出

            SELECT P_desc_1 FROM order_det WHERE Cust_name_1='vw';   

它返回nothing.shown in image 2. image_2

我不知道我哪里出错了

提前致谢

0 个答案:

没有答案