×
=0) { let js = text.slice(pos1, pos2); + '<\/' + "script" + '>'; arrText.push(js); // next pos1 = pos2; continue; } } } break; } return arrText; } function OpenDialog(parentDiv, urlContent) { parentDiv = document.getElementById('modal-background'); // new !!!!!!! parentDiv.appendChild(document.getElementById('modal-template')); document.getElementById('modal-background').style.display = "block"; document.getElementById('modal-template').style.display = "flex"; // !!!!! document.getElementById('modal-body').innerHTML = ""; post_url(urlContent, "", function(text_from_server) { var element = document.getElementById('modal-body'); element.innerHTML = text_from_server; // add scripts var arrJSText = get_scripts(text_from_server); for (var i=0; i
dir.by
Search
Programming, development, testing
→
Microsoft SQL (язык запросов в базе данных)
→
Выбрать такие проекты, где количество задач в проекте больше или равно 3 (Используем group by, having count в SQL запросе)
Looked at
4205
times
Выбрать такие проекты, где количество задач в проекте больше или равно 3 (Используем group by, having count в SQL запросе)
last updated: 7 February 2019
Таблица
Projects
Id
ProjectName
1
Project1
2
Project2
3
Project3
4
Project4
Таблица
Tasks
Id
TaskName
Estimate
ProjectId
1
AAAAA for proj1
10
1
2
BBBBBB for proj1
6
1
3
CCCCC for proj1
2
1
4
EEEEEE for proj2
8
2
5
FFFFFF for proj2
9
2
6
IIIIIIIII for proj3
3
3
7
JJJJJJJ for proj3
18
3
8
KKKKKK for proj3
1
3
9
LLLLLLL for proj3
7
3
10
MMMMM for proj3
6
3
11
NNNNNN for proj4
2
4
Выбрать такие проекты, где количество задач в проекте больше или равно 3
SQL запрос
select
ProjectId,
count
(TaskName)
as
TaskCount
from
Tasks
group by
ProjectId
having
count
(TaskName)>=3
Результат SQL запроса
ProjectId
TaskCount
1
3
3
5
Next topic →
inner join, left join, right join, outter join в SQL запросе
Your feedback ... Comments ...
Your Name
Your comment
(www links can only be added by a logged-in user)
+ Picture
Объявления
Объявления
SQL примеры
•
Выбрать такие проекты, где количество задач в проекте больше или равно 3 (Используем group by, having count в SQL запросе)
•
inner join, left join, right join, outter join в SQL запросе
•
Сделать значения в колонке неповторяющимися (добавляем к повторяющимся именам цифры) используем update set в SQL запросе
•
How to use the SQL query to split a string into words using the delimiter in SQL Server ? Creating a Stored Function in SQL Server Management Studio
Simplify complex joins and subqueries in SQL
•
Common Table Expressions (CTE) for simplify complex joins and subqueries in SQL
Оптимизация SQL
•
Оптимизация, улчшение SQL запросов
Ваши вопросы присылайте по почте:
info@dir.by