любимые = [a, b, c]
нелюбимые = [d, e, f]
function menu(лимит){
result = []
while питательность(result) < лимит{
if random() > 0.3 // число взято наобум
продукт = случайный(любимые)
else
продукт = случайный(нелюбимые)
if продукт не в result
добавить продукт в result
}
выбросить из result последнее
return result
}
SELECT
calendar.*,
subjects.id,
subjects.subject_name,
teachers_users.full_name AS teach_name
FROM calendar
JOIN subjects ON calendar.subject = subjects.id
JOIN teachers_users ON subjects.subject_teacher = teachers_users.id
WHERE calendar.class = 1;
CREATE TABLE "T" (
`action_ID` INTEGER NOT NULL,
`prov_title` TEXT NOT NULL,
`track_no` TEXT NOT NULL
);
INSERT INTO `T` VALUES
(10001,'ProvA','#12345'),
(10001,'ProvB','AB123'),
(10001,'ProvC','R-0001'),
(10002,'ProvA','AC456'),
(10002,'ProvB','R-0002'),
(10002,'ProvC','#98765');
SELECT
A.action_ID,
A.track_no,
B.track_no,
C.track_no
FROM (SELECT * FROM T WHERE prov_title = "ProvA") AS A
JOIN (SELECT * FROM T WHERE prov_title = "ProvB") AS B
JOIN (SELECT * FROM T WHERE prov_title = "ProvC") AS C
ON A.action_ID = B.action_ID AND A.action_ID = C.action_ID;