-1

当使用 php 接近测量日期时,我将向我的客户发送一封电子邮件。某项测量有效期为一年,某项有效期为 3 年,等等……因此,一家公司的数据为一行。但我想写,他的测量有多少天有效。我希望你能理解我的问题。提前致谢!亚当

我有一个结构表:

CREATE TABLE IF NOT EXISTS `meresek` (
  `ID` int(11) NOT NULL AUTO_INCREMENT,

  `COMP_ID` varchar(4) NOT NULL COMMENT 'What a company ID',

  `Comp_V` int(11) NOT NULL DEFAULT '1' COMMENT 'What size number of sites',

  `MERES_1` date DEFAULT NULL,
  `MERES_END_1` date DEFAULT NULL,
  `EV_MERES_2` date DEFAULT NULL,
  `MERES_END_2` date DEFAULT NULL,
  `MERES_3` date DEFAULT NULL,
  `MERES_END_3` date DEFAULT NULL,
  `MERES_4` date DEFAULT NULL,
  `MERES_END_4` date DEFAULT NULL,
  .
  .
  .
  .
  `MERES_END_8` date DEFAULT NULL,
  PRIMARY KEY (`ID`),
  UNIQUE KEY `COMP_ID` (`COMP_ID`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=70;


INSERT INTO `meresek` ( `ID`, `COMP_ID`, `COMP_V`,`MERES_1`
  `MERES_END_1`,
  `EV_MERES_2`,
  `MERES_END_2`,
  `MERES_3`,
  `MERES_END_3`,
   .
   .
   .
   `MERES_END_8) VALUES


(1, 'X1', 1, NULL, NULL, '2011-03-07', '2011-03-31', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),

(2, 'X2', 1, NULL, NULL, '2010-12-19', '2019-12-31', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL),

(3, 'Y11', 1, NULL, NULL, '2011-05-12', '2014-12-31', NULL, NULL, NULL, NULL, '2011-05-12', '2020-05-12', '2011-05-12', '2020-05-12', NULL, NULL, NULL, NULL),

(4, 'Y12', 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2012-02-02', '2013-02-02', '2012-02-02', '2013-02-02')
4

1 回答 1

0

选择最少(合并(col_1,col_2....col_8),合并(col_2,col_1....col_8),合并(col_3,col_1....col_8),合并(col_4,col_1....col_8),合并(col_5,col_1....col_8),合并(col_6,col_1....col_8),合并(col_7,col_1....col_8),合并(col_8,col_1....col_1))其中id ='35'

于 2013-02-02T19:41:45.737 回答