Home > database >  [for] MYSQL WHERE data is missing IN.
[for] MYSQL WHERE data is missing IN.

Time:10-12

description:
Problem or a MYSQL table structure is its own problems, the query result set is not correct, "4.817536" the number has been unable to find out to, if you change the value, the result set is correct, try direct equals' 4.817536 'MYSQL5.6 is can check out the situation of MYSQL8.0 cannot,
DDL:
 

The CREATE TABLE ` tbipm06 ` (

` ID ` int (11), NOT NULL AUTO_INCREMENT,

` REC_CREATOR ` varchar (20) NOT NULL DEFAULT 'COMMENT' record to create responsible,

` REC_CREATE_TIME ` datetime NOT NULL COMMENT 'record creation time,

` REC_REVISOR ` varchar (20) DEFAULT 'COMMENT' record to modify those,

` REC_REVISE_TIME ` datetime DEFAULT NULL COMMENT 'record to modify time,

` MAT_GROUP_NO ` varchar (64) NOT NULL COMMENT 'material code group,

` MAT_CODE ` varchar (20) NOT NULL COMMENT 'material code,

` MAT_QTY ` double (20, 8) NOT NULL DEFAULT '0.00000000' COMMENT 'material quantity,

` MAT_DESC ` varchar (255) the DEFAULT NULL COMMENT 'material note,

` IN_MAT_QTY ` double (20, 8) NOT NULL COMMENT 'import quantity (default MAT_QTY),

` IN_MAT_UOM ` varchar (10) NOT NULL COMMENT 'import unit (the default material coding units),

` PROJECT_ID ` int (11) the DEFAULT NULL COMMENT 'project ID,

DEFAULT NULL ` ARCHIVE_SIGN ` int (1) the COMMENT 'document markup (1, 2 "without archiving work", "archiving" 3, "can delete" 9, "archive operation error")',

PRIMARY KEY (` ID `),

The KEY ` PROD_CODE ` (` MAT_GROUP_NO `) USING BTREE

) ENGINE=InnoDB AUTO_INCREMENT=117380 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='component BOM table;

The correct data:
SQL
 -- -
The select MAT_CODE, MAT_QTY FROM tbipm06 WHERE MAT_GROUP_NO='ac23be5e0d3d45d89b4dd5b20adf74e3'

- the result

MAT_CODE MAT_QTY

3000402040
2.00000000
3000403011
2.00000000
3000403430
10.00000000
3000402002
0.40000000
3000402001
3.26800000
3000403013
2.00000000
3000201052
2.05337600
3000403527
2.00000000
3000201060
15.06328992
2000101001
0.53140000
3000201059
4.81753600
3000201058
13.76527000
3000201057
17.36089920
3000201056 23.05408160

Wrong data:
SQL
 -- -
The select MAT_CODE, MAT_QTY FROM tbipm06 WHERE ` MAT_QTY ` in

(2.0, 2.0, 10.0, 0.4, 3.268, 2.0, 2.053376, 2.0, 15.06328992, 0.5314, 4.817536, 13.76527, 17.3608992, 23.0540816)

AND MAT_GROUP_NO='ac23be5e0d3d45d89b4dd5b20adf74e3'

- the result

MAT_CODE MAT_QTY

3000402040
2.00000000
3000403011
2.00000000
3000403430
10.00000000
3000402002
0.40000000
3000402001
3.26800000
3000403013
2.00000000
3000201052
2.05337600
3000403527
2.00000000
3000201060
15.06328992
2000101001
0.53140000
3000201058
13.76527000
3000201057
17.36089920
3000201056 23.05408160


IN a single number:

 
SQL
-The select MAT_CODE, MAT_QTY FROM tbipm06 WHERE ` MAT_QTY ` in (4.817536) AND MAT_GROUP_NO='ac23be5e0d3d45d89b4dd5b20adf74e3'
- the result
MAT_CODE MAT_QTY
3000201059
4.81753600
  • Related