Board index » delphi » Please help with D1/SQL problem

Please help with D1/SQL problem

Hi all,

I've been tasked with maintaining an older 16bit app, and have a serious
problem with an SQL query. I am hoping someone out there can help me with it.
The IDAPI version is 2.52. The problem query takes the form of:

SELECT Field_one, Field_2, "X" as Field_req, "3/30/99" as expireation
FROM Table1 WHERE (Field_x is <> 0) and (Table_2.Field_one IN ("XXX","YYY"));

In it's present form I either get a 'Table does not exist: Table2.' error, or
most often a GPF which crashes the program.

The D1 Local SQL documentation is, well 'sparce at best' to put it mildly.

Could someone PLEASE tell me how to fix this! Or point me to some
documentation on v2.52 SQL implementation. Thanks to all and I hope you can
help me. Jim

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    

 

Re:Please help with D1/SQL problem


Quote
fornax7...@my-dejanews.com wrote:

> Hi all,

> SELECT Field_one, Field_2, "X" as Field_req, "3/30/99" as expireation
> FROM Table1 WHERE (Field_x is <> 0) and (Table_2.Field_one IN ("XXX","YYY"));

> In it's present form I either get a 'Table does not exist: Table2.' error, or
> most often a GPF which crashes the program.

Looks like you did not cut and paste that from any even nearly working
SQL sentence. What should f.ex this expression mean "Field_x is <> 0"?

Also, your error message says "Table does not exist: Table2", but
there is no Table2 in your SQL sentence, only Table_2.

Third, in FROM sentence, besides Table1 you should somehow mention
Table2 too...

I'm not able to turn your complicated sentence to anything readable.
I use this kind of style when I get data from two tables:

Select O.*, C.Custno, C.Company,C.Phone
          FROM ORDERS O, CUSTOMER C
          Where (O.CUSTNO = C.CUSTNO)
          and O.InvDate>"01/01/1900"
          and O.Paid<>"P"
          Order by Paid,DueDate

You better cut your SQL-sentence in pieces. Try starting with the second
row, and get it somehow first to go through the SQL parser, and then
continue with the first row.

Markku Nevalainen

Other Threads