R
R
Rinat2015-07-30 08:17:27
PHP
Rinat, 2015-07-30 08:17:27

How to group questions by department, with one heading?

I don’t know how to implement this, so I ask for help, there is a request:

SELECT tasks.id_tas,tasks.name_tas,tasks.data_zad_tas,
tasks.data_exe_tas,tasks.doer_tas,tasks.rubric_tas,department.titli_dep,rating.number_rat,rating.data_rat,department.id_dep
FROM `tasks` LEFT JOIN `rating` ON tasks.id_tas=rating.id_tas_rat LEFT JOIN `department` ON tasks.id_dep_tas=department.id_dep 
WHERE tasks.id_oper_tas=$id_opern ORDER BY department.id_dep, tasks.data_exe_tas ASC

SnimokPNG_6060731_18214546.png
CREATE TABLE IF NOT EXISTS `department` (
  `id_dep` int(10) NOT NULL AUTO_INCREMENT,
  `titli_dep` text COLLATE utf8_unicode_ci NOT NULL COMMENT 'название',
  PRIMARY KEY (`id_dep`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='отделы' AUTO_INCREMENT=15 ;

--
-- Дамп данных таблицы `department`
--

INSERT INTO `department` (`id_dep`, `titli_dep`) VALUES
(1, 'Отдел Сервисного Обслуживания (Мясников В.Н.)'),
(14, 'Конструкторский отдел (Евсеев Д.А.)');

-- --------------------------------------------------------

--
-- Структура таблицы `opertivka`
--

CREATE TABLE IF NOT EXISTS `opertivka` (
  `id_oper` int(9) NOT NULL AUTO_INCREMENT,
  `data_oper` date NOT NULL COMMENT 'дата',
  PRIMARY KEY (`id_oper`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='даты проведения оперативок' AUTO_INCREMENT=13 ;

--
-- Дамп данных таблицы `opertivka`
--

INSERT INTO `opertivka` (`id_oper`, `data_oper`) VALUES
(1, '2015-07-07'),
(12, '2015-06-29');

-- --------------------------------------------------------

-- Структура таблицы `rating`
--

CREATE TABLE IF NOT EXISTS `rating` (
  `id_rat` int(12) NOT NULL AUTO_INCREMENT,
  `data_rat` date NOT NULL COMMENT 'дата добавления',
  `id_tas_rat` int(9) NOT NULL COMMENT 'id задания',
  `number_rat` int(3) NOT NULL COMMENT 'рейтинг',
  PRIMARY KEY (`id_rat`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='рейтинг' AUTO_INCREMENT=54 ;

--
-- Дамп данных таблицы `rating`
--

INSERT INTO `rating` (`id_rat`, `data_rat`, `id_tas_rat`, `number_rat`) VALUES
(5, '2015-07-24', 4, 1),
(53, '2015-07-29', 6, 1);

-- --------------------------------------------------------

--
-- Структура таблицы `tasks`
--

CREATE TABLE IF NOT EXISTS `tasks` (
  `id_tas` int(10) NOT NULL AUTO_INCREMENT,
  `id_dep_tas` int(10) NOT NULL COMMENT 'id отдела',
  `id_oper_tas` int(10) NOT NULL COMMENT 'id даты оперативки',
  `data_zad_tas` date NOT NULL COMMENT 'дата задания',
  `name_tas` text COLLATE utf8_unicode_ci NOT NULL COMMENT 'описание',
  `data_exe_tas` date NOT NULL COMMENT 'дата исполнения',
  `doer_tas` varchar(100) COLLATE utf8_unicode_ci NOT NULL COMMENT 'исполнитель',
  `rubric_tas` text COLLATE utf8_unicode_ci NOT NULL COMMENT 'пояснения по проделанной работе',
  PRIMARY KEY (`id_tas`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='задания' AUTO_INCREMENT=34 ;

--
-- Дамп данных таблицы `tasks`
--

INSERT INTO `tasks` (`id_tas`, `id_dep_tas`, `id_oper_tas`, `data_zad_tas`, `name_tas`, `data_exe_tas`, `doer_tas`, `rubric_tas`) VALUES
(1, 1, 11, '2015-06-22', 'Табличка по плану мероприятий (образец, как будет вестись)\r\nТабличка по плану мероприятий (образец, как будет вестись)\r\nТабличка по плану мероприятий (образец, как будет вестись)', '2015-07-06', '', ' '),
(5, 11, 11, '2015-04-23', 'Нарисовать план-предложение как сделать тротуар, проработать вопрос по укладке плит совместно с Хомченко \r\n', '2015-07-06', ' ', 'рор'),
(6, 1, 11, '2015-11-21', 'Подготовить исковое заявление по возмещению судебных расходов «Уралагоретехсервис»\r\n', '2015-07-06', 'Ильмир', ''),
(7, 5, 1, '2015-06-18', 'Разработать маршрут получение материальных ценностей под личную ответственность\r\n', '2015-07-06', 'вапвап', ' '),
(30, 1, 11, '2015-08-27', '1взломать все компыпавfdsfsdfdsf', '2015-08-02', '1dsfsfsdfsdf', '1kjdrfge'),
(32, 0, 0, '0000-00-00', '', '0000-00-00', '', '');

I can not make a grouping by departments, with one heading.
2png_3763233_18214570.png

Answer the question

In order to leave comments, you need to log in

5 answer(s)
S
sim3x, 2018-12-25
@Hose1021

This is called fuzzing
And it refers to infobez or penetration testing
Not to unit testing
Unit testing is designed to identify problems when refactoring and writing code in a project, and not directly to security
You need to write code in such a way that it skips only what is directly
indicated the tighter the field, the better (easier) it is for you
The main purpose of tests is to allow you to write new code without fear of breaking something old

K
KiT, 2019-01-08
Maverick @kit_de

I understood correctly, you want to delegate the generation of test cases to someone?
If so, then I'm sure the testing will be of poor quality - after all, you will not control the process.

M
Max, 2015-07-30
@MaxDukov

GROUP BY?

H
heartdevil, 2015-08-01
@heartdevil

You should have something like this:
task 1 | department 1
task 2 | department 1
task 3 | department 1
task 4 | department 2
task 5 | department 2
?
then just remove the
tasks.id_oper_tas=$id_opern filter
and sort by department.

R
Rinat, 2015-08-03
@WaRstim

then just remove the
tasks.id_oper_tas=$id_opern filter

this condition is responsible for selecting only those tasks in which the id of the RAM = get (id) which we pass through the date selection menu. And as needed, shown in Figure 2. 1pic is like now

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question