![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
вложенный запрос
syte_ser78 © (2006-09-15 11:02:00)и SqlExplorer и компилятор Delphi не хочет обработать следующий вложенный запрос
sqlTemp.SQL.Text:='
select topics.title
from (
select distinct topics.title, posts.post_date
from topics, posts
where (topics.tid=posts.topic_id)
)
order by topics.title desc
';
Как его можно написать по другому?
syte_ser78 (2006-09-15 11:39:00) [1]Slym(RO) (15.09.06 11:33) [9]
Спасибо за ответ, но опять же -
> select topics.title, posts.post_date
Нужно вывсети только distinct topics.title, а компилятор просит чтобы в select было то что есть в order by
Slym(RO) (2006-09-15 11:33:00) [2]select topics.title, posts.post_date
from topics inner join posts on topics.tid=posts.topic.id
order by posts.post_date desc;
Sergey13 (2006-09-15 11:26:00) [3]> [6] syte_ser78 © (15.09.06 11:23)
Насколько я помню, LocalSQL не ест такиевложенные запросы.
select topics.title, max(posts.post_date)
from topics, posts
where topics.tid=posts.topic.id
group by posts.post_date
syte_ser78 (2006-09-15 11:23:00) [4]select distinct topics.title
from
(select topics.title, posts.post_date
from topics, posts
where topics.tid=posts.topic.id
order by posts.post_date)
Sergey13 (2006-09-15 11:23:00) [5]> [3] syte_ser78 © (15.09.06 11:18)
Первый раз слышу, что компилятор Д7 "не хочет обработать вложенный запрос". 8-)
syte_ser78 (2006-09-15 11:20:00) [6]есть две таблици. Topics и Posts
Таблица posts связана с topics отношением ного к одному по полу posts.topic_id-topics.tid
нужно вывести список topic.title отсортированый по убыванию значения поля posts.post_date
syte_ser78 (2006-09-15 11:18:00) [7]БД- парадокс. Delphi -7
Спасибо большое.
Прошу прощения. Ошибка....
Сортировать по max(posts.post_date)
syte_ser78 (2006-09-15 11:18:00) [8]извиняюсь еще раз. Пока не отвечайте, запутался совершенно
Sergey13 (2006-09-15 11:10:00) [9]> [0] syte_ser78 © (15.09.06 11:02)
Что за БД м какой компилятор не хочет?
StriderMan (2006-09-15 11:07:00) [10]select distinct t.title
from topics t JOIN posts p on (t.tid=p.topic_id)
order by t.title desc