Показать сообщение отдельно
Старый 11.04.2006, 15:50   #1  
sese is offline
sese
Участник
 
23 / 10 (1) +
Регистрация: 20.03.2006
Господа, в конструкции

while select * from Table1
where Table1.Field1 == <***>
{
while select * from CustTable
join SalesTable
where SalesTable.Field1 == Table1.Field1 &&
SalesTable.CustAccount == CustTable.AccountNum
{
...
}
}

Нужно еще выбирать запись из SalesTable по дате / SalesId первую. То есть нужна еще запись, аналогичная
select firstonly SalesId from SalesTable
order by SalesId asc
,
но ее ведь в join не вставишь. Можно решить задачу путем превращения join-a во вложение:

while select * from Table1
where Table1.Field1 == <***>
{
while select * from CustTable
{
select firstonly SalesId from SalesTable
order by SalesId asc
where SalesTable.Field1 == Table1.Field1 &&
SalesTable.CustAccount == CustTable.AccountNum;

...

}
}




А как ее решить с сохранением join-a? И можно ли вообще?