J
John
Hi
I have a winform database app that loads one record at a time. I use the
following two sqls to allow users to scroll to next and previous records;
MoveNext
SELECT TOP 1 <field list>
FROM tblClients
WHERE (ID > ?)
ORDER BY ID
Move Prev
SELECT TOP 1 <field list>
FROM tblClients
WHERE (ID < ?)
ORDER BY ID DESC
This works fine on a unique id and when records are scrolled in id order.
The client now wants the records scrolled in company type+company name
order. The problem is that niether company type nor company name is unique
and it is difficult to select next record in sequence without a unique id as
to which is the next record. How can I achieve the scrolling in company
type+company name order one record at a time?
Thanks
Regards
I have a winform database app that loads one record at a time. I use the
following two sqls to allow users to scroll to next and previous records;
MoveNext
SELECT TOP 1 <field list>
FROM tblClients
WHERE (ID > ?)
ORDER BY ID
Move Prev
SELECT TOP 1 <field list>
FROM tblClients
WHERE (ID < ?)
ORDER BY ID DESC
This works fine on a unique id and when records are scrolled in id order.
The client now wants the records scrolled in company type+company name
order. The problem is that niether company type nor company name is unique
and it is difficult to select next record in sequence without a unique id as
to which is the next record. How can I achieve the scrolling in company
type+company name order one record at a time?
Thanks
Regards