Skip to Content
0
Former Member
Jan 03, 2008 at 02:25 AM

Dynamic select sql statement

94 Views

Hi currently i have a problem with the sql statement.

The field name and the table name of the sql statement will depend on what the user input. We need to find out what records is in tableA columnA and not in tableB columnB.

Below is my sql statement:

SELECT * FROM (TABLEA) INTO TABLE ITABA

WHERE (COLUMNA)

NOT IN ( SELECT (COLUMNB) FROM (TABLEB) ).

=============================================

ColumnA = "the user input the field name"

TableA = " the user input the table name"

TableB = " the user input the table name"

The problem lies at the WHERE clause. The system generate a sql error which says "unable to find the field name".