Chris,

There are a lot of possibilities there. If you are using ODBC the first
thing that comes to mind is whether or not one of the columns you are
querying is a text data type. I've used queries with similar complexity on
SQL 6.5 and 7.0, so complexity is not the issue. If you are getting an
error, though that might be helpful - particularly if your error deals with
what I assume is a date column (dd.full_date). Anyway some indication of
what kind of behavior you are getting would be helpful.

BTW. Very, very nice SQL work - and from reading through the joins, it looks
like nice design work as well.

Steve Howard


-----Original Message-----
From: Kutler, Christopher [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 17, 2001 11:37 AM
To: 'DBI User Group'
Subject: Complex SQL statments - Do they work?


Hello All

I've tried the following SQL statement which does work via SQL Server 6.5.
However, it does't seem to work when I run the same statment through DBI:

select p.pieceref, d.document_id, dd.full_date,
grant_description, heading,
convert(varchar(255), document_type_description) as document_description,
physical_format,
number_of_folios_etc, language = CASE
 when english_indicator = 1 then 'English'
when french_indicator = 1 then 'French'
when Latin_indicator = 1 then 'Latin'
 END, convert(varchar(255), document_note) as document_note,
names_indicator = CASE names_indicator when 1 then 'includes names of
individuals' END,
goods_indicator = CASE goods_indicator when 1 then 'includes record of goods
assessed' END
 from list_heading as lh
inner join piece_heading as ph on lh.heading_id = ph.heading_id
inner join piece as p on ph.piece_id = p.piece_id
left outer join document as d on p.piece_id = d.piece_id
left outer join document_grant as dg on d.document_id = dg.document_id
inner join grant_ as g on dg.grant_id = g.grant_id
inner join document_date as dd on d.document_id = dd.document_id
order by p.pieceref

Any help would be appreciated.

thanks

Chris

Reply via email to