Eric,

How would LOCATE be used in my sample SQL ?

select FFORMID,
char(max(Case when FFIELDNAM like '%Fld1'
then trim(ffieldval) end),30) as fld1 ,
char(max(Case when FFIELDNAM like '%Fld2'
then trim(ffieldval) end),30) as fld2
from formfld where FFORMID =
'cb3c0801-93a8-1940-ad63-0004ac10'
group by fformid

Regards,
Richard Schoen
RJS Software Systems Inc.
Where Information Meets Innovation
Document Management, Workflow, Report Delivery, Forms and Business Intelligence
Email: richard@xxxxxxxxxxxxxxx
Web Site: http://www.rjssoftware.com
Tel: (952) 736-5800
Fax: (952) 736-5801
Toll Free: (888) RJSSOFT
------------------------------

message: 3
date: Mon, 3 Dec 2012 16:02:28 +0000
from: "DeLong, Eric" <EDeLong@xxxxxxxxxxxxxxx>
subject: RE: Interesting SQL Question - Flatten Multiple Records into
One Record

A close look at your sample SQL shows I should have recommended LOCATE() instead.

LOCATE(FFIELDNAM, 'Field1') > 0 indicates the value "Field1" is in string FFIELDNAM.

-Eric DeLong






Return to Archive home page | Return to MIDRANGE.COM home page