Unsupported Screen Size: The viewport size is too small for the theme to render properly.

I Need A Query

forums forums SQLyog Using SQLyog I Need A Query

  • This topic is empty.
Viewing 1 reply thread
  • Author
    Posts
    • #12412
      ammreddy
      Member

      Hi,

      I WANT TO CALCULATE SUM OF HOURS ACCORDING TO THE ID_DES ORDER BY ISSUE ID.how IT IS POSSIBLE.FIND THE TABLES LIKE THIS

      i have two tables in MySQL server

      TIME_ENTRIES

      id isue_id hours activity_idcreated_on updated_on

      1 1 4 16 2011-07-09 09:50:28 2011-07-09 09:50:28

      2 1 2 17 2011-07-09 09:50:46 2011-07-09 09:50:46

      3 1 1 18 2011-07-09 09:52:46 2011-07-09 09:52:46

      4 1 2 23 2011-07-09 09:55:24 2011-07-09 09:55:24

      5 1 0 24 2011-07-09 09:55:39 2011-07-09 09:55:39

      6 1 0.25 25 2011-07-09 09:55:57 2011-07-09 09:55:57

      7 1 4 27 2011-07-09 09:56:11 2011-07-09 09:56:11

      8 2 5 16 2011-07-09 16:49:03 2011-07-09 16:49:03

      9 14 1 27 2011-07-12 10:09:32 2011-07-12 10:09:32

      10 20 1 27 2011-07-12 11:50:13 2011-07-12 11:50:13

      11 7 0 16 2011-07-12 12:02:59 2011-07-12 12:02:59

      12 27 0 27 2011-07-12 15:12:45 2011-07-12 15:12:45

      13 56 2 18 2011-07-14 15:06:19 2011-07-14 15:06:19

      14 46 2 16 2011-07-14 15:28:12 2011-07-14 15:28:12

      15 41 2 16 2011-07-14 15:28:28 2011-07-14 15:28:28

      16 10 4 16 2011-07-14 15:28:43 2011-07-14 15:28:43

      17 65 2 16 2011-07-14 15:52:10 2011-07-14 15:52:10

      18 65 2 18 2011-07-14 15:53:02 2011-07-14 15:53:02

      19 65 2 18 2011-07-14 15:53:36 2011-07-14 15:53:36

      20 65 2 27 2011-07-14 15:54:56 2011-07-14 15:54:56

      21 56 2 16 2011-07-14 16:15:55 2011-07-14 16:15:55

      22 49 3 16 2011-07-14 16:44:23 2011-07-14 16:44:23

      23 49 2 16 2011-07-14 16:46:14 2011-07-14 16:46:14

      24 49 2 16 2011-07-14 16:46:46 2011-07-14 16:46:46

      25 49 2 16 2011-07-14 16:47:02 2011-07-14 16:47:02

      26 49 4 16 2011-07-14 16:47:25 2011-07-14 16:47:25

      27 49 2 16 2011-07-14 16:55:14 2011-07-14 16:55:14

      28 49 2 16 2011-07-14 16:55:36 2011-07-14 16:55:36

      29 49 2 16 2011-07-14 16:58:24 2011-07-14 16:58:24

      30 69 1 27 2011-07-15 09:54:29 2011-07-15 09:54:29

      id trac_id status_id created_on updated_on

      1 1 5 2011-07-09 09:47:54 2011-07-09 09:56:12

      2 1 1 2011-07-09 16:46:34 2011-07-09 16:46:34

      3 1 1 2011-07-11 17:24:30 2011-07-11 17:24:30

      4 1 1 2011-07-11 17:29:11 2011-07-11 17:29:11

      5 1 1 2011-07-11 17:37:00 2011-07-11 17:37:00

      6 1 1 2011-07-11 17:40:12 2011-07-11 17:40:12

      7 1 1 2011-07-11 17:43:00 2011-07-11 17:43:00

      8 1 1 2011-07-11 17:44:39 2011-07-11 17:44:39

      9 1 1 2011-07-11 17:46:19 2011-07-11 17:46:19

      10 1 18 2011-07-11 18:39:14 2011-08-08 10:16:47

      11 1 21 2011-07-11 18:52:31 2011-07-18 12:51:17

      12 1 5 2011-07-12 09:18:00 2011-07-16 12:29:40

      13 1 5 2011-07-12 09:29:46 2011-07-18 12:37:32

      14 1 5 2011-07-12 10:07:12 2011-07-21 11:50:32

      15 1 1 2011-07-12 10:15:11 2011-07-12 10:15:11

      16 1 1 2011-07-12 10:16:30 2011-07-12 10:16:30

      18 1 5 2011-07-12 10:30:14 2011-07-21 11:51:34

      19 1 5 2011-07-12 11:07:43 2011-07-12 17:03:56

      20 1 5 2011-07-12 11:41:56 2011-07-12 11:50:13

      21 1 5 2011-07-12 11:48:58 2011-08-08 14:46:19

      22 1 5 2011-07-12 11:49:59 2011-08-08 14:44:13

      23 1 5 2011-07-12 12:26:48 2011-07-19 09:59:11

      24 1 5 2011-07-12 14:19:17 2011-08-08 14:41:56

      25 1 14 2011-07-12 14:20:23 2011-08-06 16:57:24

      26 1 5 2011-07-12 14:43:13 2011-07-12 17:03:10

      27 1 5 2011-07-12 15:05:12 2011-07-12 15:12:45

      28 1 5 2011-07-12 15:09:22 2011-08-08 14:39:27

      29 1 5 2011-07-12 15:55:21 2011-08-06 10:28:39

      30 1 5 2011-07-12 15:57:47 2011-08-06 10:27:52

      31 1 5 2011-07-12 16:00:24 2011-08-06 10:26:07

      32 1 5 2011-07-12 16:01:32 2011-08-06 10:22:26

      33 1 5 2011-07-12 16:03:35 2011-08-06 10:19:25

      34 1 5 2011-07-12 16:06:15 2011-08-06 10:18:41

      35 1 5 2011-07-12 16:11:47 2011-08-06 10:29:57

      36 1 21 2011-07-12 16:29:13 2011-07-16 11:42:24

      37 1 5 2011-07-12 16:31:20 2011-07-18 12:33:07

      38 1 5 2011-07-12 16:34:51 2011-07-21 11:49:32

      39 1 5 2011-07-12 16:36:51 2011-07-18 12:40:16

      40 1 1 2011-07-12 16:41:13 2011-07-12 16:41:13

      41 1 18 2011-07-12 16:43:49 2011-07-16 12:38:07

      42 1 18 2011-07-12 16:52:24 2011-08-06 17:42:14

      43 1 1 2011-07-12 16:52:36 2011-07-14 15:37:26

      44 1 1 2011-07-12 16:57:10 2011-07-12 17:03:11

      45 1 5 2011-07-12 17:03:53 2011-08-06 10:31:36

      46 1 5 2011-07-12 17:16:09 2011-07-18 12:34:49

      47 1 5 2011-07-13 14:21:16 2011-08-08 14:41:07

      48 1 14 2011-07-13 14:22:21 2011-08-06 17:13:37

      49 1 5 2011-07-13 15:05:38 2011-07-16 11:38:02

      50 1 5 2011-07-13 17:08:15 2011-08-06 12:01:17

      51 1 5 2011-07-13 17:09:35 2011-08-06 10:37:57

      52 1 5 2011-07-13 17:12:24 2011-08-06 12:02:29

      53 1 5 2011-07-13 17:23:24 2011-08-06 10:43:58

      54 1 1 2011-07-14 10:40:20 2011-07-14 10:40:20

      55 1 18 2011-07-14 11:45:35 2011-08-06 17:30:09

      56 1 5 2011-07-14 12:25:39 2011-07-14 16:17:35

      57 1 5 2011-07-14 14:18:58 2011-08-06 10:45:32

      58 1 5 2011-07-14 14:19:58 2011-07-22 16:23:52

      59 1 5 2011-07-14 14:20:57 2011-07-22 16:21:34

      60 1 5 2011-07-14 14:22:22 2011-07-30 15:55:06

      61 1 5 2011-07-14 14:23:55 2011-07-22 16:18:34

      62 1 14 2011-07-14 14:42:32 2011-08-06 17:16:18

      63 1 1 2011-07-14 14:43:30 2011-07-14 14:43:30

      64 1 1 2011-07-14 14:44:19 2011-07-14 14:44:19

      65 1 5 2011-07-14 15:47:38 2011-07-14 15:55:20

      66 1 1 2011-07-14 15:59:39 2011-07-14 16:00:42

      67 1 5 2011-07-14 16:32:09 2011-07-21 11:51:00

      68 1 5 2011-07-14 16:37:09 2011-07-21 11:50:04

      69 1 5 2011-07-15 09:54:06 2011-07-16 12:17:24

      70 1 5 2011-07-15 10:04:13 2011-07-18 12:42:25

      71 1 1 2011-07-15 12:33:35 2011-07-25 14:58:31

      72 1 5 2011-07-15 12:51:17 2011-07-22 16:17:18

      73 1 5 2011-07-15 12:52:38 2011-08-06 10:46:31

      74 1 21 2011-07-15 12:53:40 2011-08-06 10:51:29

      75 1 5 2011-07-15 12:54:21 2011-07-22 16:12:29

      76 1 5 2011-07-15 12:55:38 2011-08-06 10:47:31

      77 1 1 2011-07-15 14:29:39 2011-07-15 14:29:39

      78 1 5 2011-07-15 14:33:31 2011-07-16 12:27:54

      79 1 1 2011-07-15 14:43:46 2011-07-15 14:48:43

      80 1 5 2011-07-15 14:44:43 2011-07-16 12:24:50

      81 1 1 2011-07-15 14:48:57 2011-07-15 14:48:57

      82 1 1 2011-07-15 14:49:35 2011-07-15 14:51:19

      83 1 1 2011-07-15 14:50:02 2011-07-15 15:06:51

      84 1 1 2011-07-15 14:51:58 2011-07-15 14:51:58

      85 1 1 2011-07-15 14:56:28 2011-07-15 14:56:28

      86 1 1 2011-07-15 15:07:45 2011-07-15 15:07:45

      87 1 14 2011-07-15 15:14:17 2011-07-18 16:35:49

      88 1 1 2011-07-15 15:19:03 2011-07-15 15:19:32

      89 1 1 2011-07-15 15:21:07 2011-07-25 14:59:47

      90 1 1 2011-07-15 15:48:46 2011-07-15 15:48:46

      91 1 1 2011-07-15 15:59:53 2011-07-15 15:59:53

      92 1 18 2011-07-15 16:12:06 2011-08-06 17:41:56

      93 1 5 2011-07-15 16:15:00 2011-08-08 10:34:16

      94 1 14 2011-07-15 16:18:06 2011-07-15 17:04:34

      95 1 14 2011-07-15 16:19:28 2011-07-25 15:00:45

      96 1 1 2011-07-15 16:27:46 2011-07-15 16:27:46

      97 1 5 2011-07-15 16:29:02 2011-07-22 16:13:11

      98 1 5 2011-07-15 16:42:28 2011-08-06 17:43:53

      99 1 5 2011-07-15 17:16:51 2011-07-19 08:54:41

      100 1 1 2011-07-16 10:21:46 2011-07-25 16:26:39

      101 1 5 2011-07-16 10:32:44 2011-07-22 15:26:23

      102 1 5 2011-07-16 10:56:45 2011-08-06 17:46:25

      103 1 5 2011-07-16 10:57:20 2011-08-05 11:51:23

      104 1 5 2011-07-16 11:04:16 2011-07-22 15:25:51

      105 1 5 2011-07-16 11:11:20 2011-07-22 15:25:14

      106 1 5 2011-07-16 11:14:33 2011-07-19 10:32:13

      107 1 5 2011-07-16 11:17:20 2011-07-22 15:24:02

      108 1 14 2011-07-16 11:25:04 2011-07-18 13:02:58

      109 5 1 2011-07-16 11:32:21 2011-07-16 11:34:10

      110 5 1 2011-07-16 11:42:13 2011-07-16 11:42:13

      111 1 1 2011-07-16 11:44:21 2011-07-16 11:44:21

      112 5 1 2011-07-16 11:46:42 2011-07-16 11:46:42

      113 5 1 2011-07-16 11:47:21 2011-07-16 11:47:21

      114 1 5 2011-07-16 11:59:58 2011-07-19 14:08:26

      115 5 1 2011-07-16 12:01:42 2011-07-16 12:01:42

      116 5 1 2011-07-16 12:03:17 2011-07-16 12:03:17

      117 1 5 2011-07-16 12:16:13 2011-07-19 14:09:14

      118 1 1 2011-07-16 12:26:09 2011-07-16 12:26:09

      119 1 1 2011-07-16 12:26:10 2011-07-16 12:26:55

      120 1 5 2011-07-16 12:28:53 2011-07-20 12:51:33

      121 1 1 2011-07-16 12:31:47 2011-08-01 12:50:21

      122 1 5 2011-07-16 12:40:30 2011-08-06 17:47:16

      123 1 5 2011-07-16 12:47:02 2011-07-19 14:06:16

      124 1 1 2011-07-16 14:46:45 2011-07-16 14:47:06

      125 1 1 2011-07-16 14:48:26 2011-07-16 14:48:36

      126 1 1 2011-07-16 14:50:01 2011-07-16 14:50:23

      127 1 5 2011-07-16 14:53:33 2011-07-26 15:41:10

      128 1 5 2011-07-16 15:27:40 2011-08-06 10:48:20

      129 1 5 2011-07-16 15:32:28 2011-08-06 10:49:45

      130 1 5 2011-07-16 15:34:37 2011-08-06 10:52:00

      131 1 5 2011-07-16 16:03:34 2011-07-30 16:02:25

      134 1 1 2011-07-16 16:30:22 2011-07-16 16:30:22

      135 1 1 2011-07-16 16:36:23 2011-07-16 16:36:23

      136 1 1 2011-07-16 16:42:09 2011-07-16 16:42:09

      137 1 1 2011-07-16 16:50:16 2011-07-16 16:50:16

      138 1 1 2011-07-16 17:03:36 2011-07-16 17:03:36

      139 1 17 2011-07-16 17:07:04 2011-08-08 10:23:53

      140 1 15 2011-07-16 17:09:12 2011-08-08 12:24:52

      141 1 14 2011-07-16 17:13:28 2011-08-09 15:17:26

      142 1 14 2011-07-16 17:13:29 2011-08-09 15:16:25

      143 1 14 2011-07-16 17:21:03 2011-08-08 10:24:24

      144 1 14 2011-07-16 17:24:13 2011-08-08 10:22:27

      145 1 18 2011-07-16 17:27:17 2011-08-08 10:16:09

      146 1 18 2011-07-16 17:44:07 2011-08-08 10:20:38

      147 1 5 2011-07-16 17:45:49 2011-08-08 10:58:33

      148 1 14 2011-07-16 17:49:04 2011-08-08 10:11:58

      149 1 14 2011-07-16 17:52:29 2011-07-18 11:11:10

      150 1 14 2011-07-16 18:01:59 2011-08-08 10:11:09

      151 1 5 2011-07-18 10:15:26 2011-07-19 10:30:50

      152 1 1 2011-07-18 11:03:17 2011-07-18 11:27:40

      153 1 5 2011-07-18 11:44:56 2011-08-08 10:56:21

      154 1 5 2011-07-18 11:57:33 2011-08-06 10:13:32

      155 1 5 2011-07-18 12:04:40 2011-07-29 10:26:20

      156 1 5 2011-07-18 12:50:18 2011-08-06 10:53:04

      157 1 1 2011-07-18 14:22:49 2011-07-18 14:23:12

      158 1 1 2011-07-18 14:56:53 2011-07-18 14:56:53

      159 1 14 2011-07-18 14:58:04 2011-07-20 18:36:41

      160 1 5 2011-07-18 15:02:52 2011-08-06 10:56:11

      161 1 5 2011-07-18 15:09:06 2011-08-06 10:54:00

      162 5 1 2011-07-18 16:26:14 2011-07-18 17:17:59

      163 1 1 2011-07-18 17:15:22 2011-08-01 12:26:09

      164 1 5 2011-07-18 17:45:14 2011-07-30 16:29:36

      165 1 14 2011-07-18 18:21:39 2011-07-19 09:32:18

      166 1 5 2011-07-19 09:04:20 2011-07-21 11:37:12

      167 1 5 2011-07-19 10:00:27 2011-07-30 16:30:54

      168 1 5 2011-07-19 10:03:42 2011-07-30 16:31:59

      169 1 5 2011-07-19 10:05:08 2011-08-08 10:56:23

      170 1 5 2011-07-19 10:10:50 2011-07-19 10:21:00

      172 1 1 2011-07-19 10:42:46 2011-07-19 10:42:58

      173 1 1 2011-07-19 10:45:05 2011-07-19 10:45:24

      174 1 5 2011-07-19 11:26:47 2011-07-26 15:39:26

      175 1 1 2011-07-19 12:07:28 2011-07-19 12:07:28

      176 1 14 2011-07-19 12:31:25 2011-07-21 09:46:34

      177 1 5 2011-07-19 14:27:18 2011-07-27 11:41:45

      178 1 5 2011-07-19 14:40:37 2011-07-22 15:49:23

      179 1 1 2011-07-19 14:41:27 2011-07-19 14:41:27

      180 1 5 2011-07-19 14:42:23 2011-07-22 15:54:37

      181 1 1 2011-07-19 14:44:47 2011-07-19 14:44:47

      182 1 5 2011-07-19 14:44:48 2011-07-30 16:33:50

      183 1 1 2011-07-19 14:55:47 2011-07-19 14:55:47

      184 1 1 2011-07-19 15:02:20 2011-08-01 10:49:40

      185 1 1 2011-07-19 15:07:18 2011-07-31 12:30:34

      186 1 5 2011-07-19 15:13:24 2011-07-25 11:20:18

      187 1 5 2011-07-19 15:21:17 2011-08-06 10:59:42

      188 1 1 2011-07-19 16:00:52 2011-07-31 12:28:58

      189 1 5 2011-07-19 17:01:32 2011-07-22 15:40:49

      190 1 5 2011-07-19 17:26:09 2011-08-08 10:32:20

      191 1 21 2011-07-19 17:29:45 2011-08-08 10:46:14

      192 1 5 2011-07-20 09:05:06 2011-07-21 11:36:21

      193 1 5 2011-07-20 10:27:11 2011-08-06 12:38:26

      194 1 5 2011-07-20 10:29:12 2011-08-06 12:36:25

      195 1 5 2011-07-20 11:43:29 2011-07-22 15:17:10

      196 1 5 2011-07-20 17:12:46 2011-08-08 11:19:14

      197 1 5 2011-07-21 14:02:40 2011-08-05 11:13:19

      198 1 5 2011-07-21 14:04:13 2011-08-05 10:54:10

      199 1 5 2011-07-21 14:05:44 2011-08-05 10:52:43

      200 1 5 2011-07-21 14:09:04 2011-08-06 12:37:10

      201 1 5 2011-07-21 14:10:27 2011-08-05 17:13:52

      202 1 5 2011-07-21 15:04:29 2011-08-05 10:49:15

      203 4 5 2011-07-21 15:44:34 2011-07-25 15:26:23

      204 1 5 2011-07-21 16:11:33 2011-08-05 10:47:43

      now i am posting my procedure query

      i want the result according to the id

      Id Req.Dev Req.Rev Req.Rework Design Desingn review desingn rework………………….

      203 1 5 5 10 2 5 ………………

      253 5 5 5 5 2 5

      DELIMITER $$

      DROP PROCEDURE IF EXISTS `bitnami_redmine`.`weekly_data`$$

      CREATE DEFINER=`root`@`localhost` PROCEDURE `weekly_data`(in sd date,in ed date)

      BEGIN

      Declare Req_Dev float(7,3);

      Declare Req_Review float(7,3);

      Declare Req_Rework float(7,3);

      Declare Design_Dev float(7,3);

      Declare Design_Review float(7,3);

      Declare Design_Rework float(7,3);

      Declare Coding float(7,3);

      Declare Unit_Testing float(7,3);

      Declare Code_Review float(7,3);

      Declare Code_Rework float(7,3);

      Declare Int_Test_Case_Dev float(7,3);

      Declare Int_Test_Case_Review float(7,3);

      Declare Int_Test_Case_Rework float(7,3);

      Declare System_Test_Case_Dev float(7,3);

      Declare System_Test_Case_Review float(7,3);

      Declare System_Test_Case_Rework float(7,3);

      Declare Integration_Testing float(7,3);

      Declare System_Testing float(7,3);

      Declare Sys_Tst_Defects int(7);

      set Req_Dev = (select SUM(hours)as 'Requirements Development' from time_entries where activity_id=10 and issue_id in (select id from issues where tracker_id = 4 and status_id = 5) and created_on BETWEEN sd and ed and updated_on BETWEEN sd and ed group by issue_id);

      set Req_Review = (select SUM(hours) as 'Requirements Review' from time_entries where activity_id=11 and issue_id in (select id from issues where tracker_id = 4 and status_id = 5) and created_on BETWEEN sd and ed and updated_on BETWEEN sd and ed group by issue_id);

      set Req_Rework =(select SUM(hours) as 'Requirements Rework' from time_entries where activity_id=12 and issue_id in (select id from issues where tracker_id = 4 and status_id = 5) and created_on BETWEEN sd and ed and updated_on BETWEEN sd and ed group by issue_id );

      set Design_Dev =(select SUM(hours) as 'Design Development' from time_entries where activity_id=13 and issue_id in (select id from issues where tracker_id = 4 and status_id = 5) and created_on BETWEEN sd and ed and updated_on BETWEEN sd and ed group by issue_id);

      set Design_Review =(select SUM(hours) as 'Design Review' from time_entries where activity_id=14 and issue_id in (select id from issues where tracker_id = 4 and status_id = 5) and created_on BETWEEN sd and ed and updated_on BETWEEN sd and ed group by issue_id );

      set Design_Rework=(select SUM(hours) as 'Design Rework' from time_entries where activity_id=15 and issue_id in (select id from issues where tracker_id = 4 and status_id = 5) and created_on BETWEEN sd and ed and updated_on BETWEEN sd and ed group by issue_id);

      set Coding=(select SUM(hours) as 'Coding' from time_entries where activity_id=16 and issue_id in (select id from issues where tracker_id = 4 and status_id = 5) and created_on BETWEEN sd and ed and updated_on BETWEEN sd and ed group by issue_id);

      set Unit_Testing =(select SUM(hours) as 'Unit Testing' from time_entries where activity_id=17 and issue_id in (select id from issues where tracker_id = 4 and status_id = 5) and created_on BETWEEN sd and ed and updated_on BETWEEN sd and ed group by issue_id );

      set Code_Review =(select SUM(hours) as 'Code Review' from time_entries where activity_id=18 and issue_id in (select id from issues where tracker_id = 4 and status_id = 5) and created_on BETWEEN sd and ed and updated_on BETWEEN sd and ed group by issue_id);

      set Code_Rework =(select SUM(hours) as 'Code Rework' from time_entries where activity_id=19 and issue_id in (select id from issues where tracker_id = 4 and status_id = 5) and created_on BETWEEN sd and ed and updated_on BETWEEN sd and ed group by issue_id);

      set Int_Test_Case_Dev =(select SUM(hours) as 'Int Test Case Development' from time_entries where activity_id=20 and issue_id in (select id from issues where tracker_id = 4 and status_id = 5) and created_on BETWEEN sd and ed and updated_on BETWEEN sd and ed group by issue_id);

      set Int_Test_Case_Review=(select SUM(hours) as 'Int Test Case Review' from time_entries where activity_id=21 and issue_id in (select id from issues where tracker_id = 4 and status_id = 5) and created_on BETWEEN sd and ed and updated_on BETWEEN sd and ed group by issue_id);

      set Int_Test_Case_Rework =(select SUM(hours) as 'Int Test Case Rework' from time_entries where activity_id=22 and issue_id in (select id from issues where tracker_id = 4 and status_id = 5) and created_on BETWEEN sd and ed and updated_on BETWEEN sd and ed group by issue_id);

      set System_Test_Case_Dev =(select SUM(hours) as 'System Test Case Development' from time_entries where activity_id=23 and issue_id in (select id from issues where tracker_id = 4 and status_id = 5) and created_on BETWEEN sd and ed and updated_on BETWEEN sd and ed group by issue_id);

      set System_Test_Case_Review =(select SUM(hours) as 'System Test Case Review' from time_entries where activity_id=24 and issue_id in (select id from issues where tracker_id = 4 and status_id = 5) and created_on BETWEEN sd and ed and updated_on BETWEEN sd and ed group by issue_id);

      set System_Test_Case_Rework =(select SUM(hours) as 'System Test Case Rework' from time_entries where activity_id=25 and issue_id in (select id from issues where tracker_id = 4 and status_id = 5) and created_on BETWEEN sd and ed and updated_on BETWEEN sd and ed group by issue_id);

      set Integration_Testing =(select SUM(hours)as 'Integration Testing' from time_entries where activity_id=26 and issue_id in (select id from issues where tracker_id = 4 and status_id = 5) and created_on BETWEEN sd and ed and updated_on BETWEEN sd and ed group by issue_id);

      set System_Testing = (select SUM(hours) as 'System Testing' from time_entries where activity_id=27 and issue_id in (select id from issues where tracker_id = 4 and status_id = 5) and created_on BETWEEN sd and ed and updated_on BETWEEN sd and ed group by issue_id);

      set Sys_Tst_Defects= (select count(id) from issues where tracker_id=1 and tracker_id = 4 and status_id = 5);

      select Req_Dev,Req_Review,Req_Rework,Design_Dev,Design_Review,Design_Rework,Coding,Unit_Testing,Code_Review,Code_Rework,Int_Test_Case_Dev,Int_Test_Case_Review,Int_Test_Case_Rework,System_Test_Case_Dev,System_Test_Case_Review,System_Test_Case_Rework,Integration_Testing,System_Testing,Sys_Tst_Defects;

      END$$

      DELIMITER ;

    • #32514
      peterlaursen
      Participant

      I have moved your post to a more appropriate categoy.

      This question is outside the scope of our product support as it is a general SQL question.

      But what is the problem? Do you get an error (and which one then?) when creating the routine, does the calculation render incorrect results? In case of error try identify *where* the error occurs (run queries one by one in the editor and not wrapped in a Stored Procedure.

      Also if you want help with such case you should provide a smaller and more readable test case (use the option to add CODE tags around tabular datasets etc.). Once you have reduced the test case you may also very well be able to identify the problem yourself. And alos to make it simpler for people you ask for help you should provide importable SQL dump of table structures and data.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.