|Subject||Re: [ib-support] join-sort question|
|Author||Svein Erling Tysvær|
>select p.*, s.* from patients p left outer join patientstatus sSimple one. You order by name, but don't specify which name (patients or
>on ((p.id=s.id) and (p.name=s.name)) order by name
>trouble is this returns the rows that have matching records in both tables
>in order and then the records that only have only data in the primary table
>in no particular order.
patientstatus). IB selects the wrong name, and since some of the records
doesn't have anything in this field, they're ordered randomly. Just change
your query to
select p.*, s.* from patients p left outer join patientstatus s
on ((p.id=s.id) and (p.name=s.name)) order by patients.name
and you should be fine.