Господа, в конструкции
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? И можно ли вообще?
|