Ответить на сообщение
Вернуться к теме
Вы отвечаете на сообщение:
ник: osmor решение в лоб:
SELECT DepID, ParentID as ancestorID FROM Departments WHERE (((Departments.ParentID)<>0)) Union ALL SELECT D.DepID, D1.ParentId as ancestorID FROM Departments as D , Departments AS D1 WHERE D.ParentId = D1.DepID and D1.ParentID<>0 Union ALL SELECT D.DepID, D2.ParentId as ancestorID FROM Departments as D , Departments AS D1,Departments as D2 WHERE D.ParentId = D1.DepID and D1.ParentID = D2.DepID and D2.ParentID<>0 Order by DepId, ancestorID DESC
SELECT DepID, ParentID as ancestorID FROM Departments WHERE (((Departments.ParentID)<>0)) Union ALL SELECT D.DepID, D1.ParentId as ancestorID FROM Departments as D , Departments AS D1 WHERE D.ParentId = D1.DepID and D1.ParentID<>0 Order by DepId, ancestorID DESC
Ваше имя:
Пароль:
Сообщение:
Прикрепить:
Для вставки смайлов в текст щелкните по значку.