Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread LIKE causes incorrect ORDER BY results
Wed, Mar 4 2009 11:24 AMPermanent Link

"Hedley Muscroft"
Hi Tim,

This query works fine :-
------------------
select reportcat.name as category, report.id, report.name, report.options,
report.reporttype
from report
left join reportcat on (report.reportcat_id=reportcat.id)
order by reportcat.name, report.name
------------------

This one doesn't obey the ORDER BY clause :-
------------------
select reportcat.name as category, report.id, report.name, report.options,
report.reporttype
from report
left join reportcat on (report.reportcat_id=reportcat.id)
where report.options COLLATE UNI_CI like '%frmEditorPatient%'
order by reportcat.name, report.name
------------------

Here's the database you can test it with :-
http://files.pioneersoftware.co.uk/temp/SampleDB.7z

Hope this is an easy fix!
Thu, Mar 5 2009 1:24 PMPermanent Link

"Hedley Muscroft"
Has anyone else had this problem before or managed to reproduce it, or is it
just me? Frown
Thu, Mar 5 2009 3:41 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Hedley,

<< This one doesn't obey the ORDER BY clause :- >>

Use the correlation name:

select reportcat.name as category, report.id, report.name, report.options,
report.reporttype
from report
left join reportcat on (report.reportcat_id=reportcat.id)
where report.options COLLATE UNI_CI like '%frmEditorPatient%'
order by category, report.name

I'll make sure that a fix is in 2.02 B9.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image