Hello Xu,

> In delphi and MaoInfo Ole , I wrote this code:
>
> //-------------------------code
> ..
> ts := '';
>  for j := 0 to 34 do begin
>   if j<>34 then
>     ts := ts + 'bs_no = "'+slist.strings[j] + '" OR '
>     else
>     ts := ts + 'bs_no = "'+slist.strings[j] + '"';
>  end;    // for
>  ts := 'Select * from CELL where '+ts;
>  MapInfo.Do(ts);
> ...
> //-------------------------code
>  It runs Ok!
>  but when i change "34" --> "35">
>  it runs error , mapinfo show error message box " Expression too complex".
>  Why? How can i do?

Wow! A 35 part where clause! Is this really necessary in your application? I
am sure there is a limit to the number of clauses, or length of SQL command,
in MI/MB and I'm not surprised that you've hit it. Two potential solutions:

1) Restructure your database so that the number of clauses is reduced. If
you have 35 logical fields which you are OR testing, perhaps you could
combined these into a single indexed string field (e.g. "YNNYYNYN...") .
Although sub-string SQL queries are not great in MI/MB, the performance may
be comparable with such a complex original SQL statement. If your table are
relatively small, performance is probably not an issue anyway.

2) If the number of fields has to remain, consider breaking your query into
more that one sub-query parts and combine the results (perhaps inserting
them into a temporary results table). Since you're ORing, you just need to
combine and remove duplicates. Work with ANDs would be a bit more
complicated.

Sounds like a "data rich" project. Good luck!

Regards,
Warren Vick
Europa Technologies Ltd, U.K.
http://www.europa-tech.com


----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to