Skip to Content
0
Former Member
Mar 24, 2010 at 02:02 PM

Dynamic From statement in select query and/or outer join not working

245 Views

Dear Experts, I have a select query where the select columns are dynamic, the where condition is also dynamic. It is of the below format:

Select (dynamic columns) INTO <wa>

FROM a inner join b on af1 = bf1

inner join c on af2 = cf2......

WHERE (dynamic conditios)

ORDER BY ( dynamic sort condition).

Now I have to include some tables (dynamically depending on the user input) in the inner join statement which will give description for the selected fields. And these database tables may or may no be empty. So in this case, my select query will not return any data if these tables are empty. And I dont want that.

I tried using outer join for the extra tables but it gave me a runtime error. I also tried forming the inner join statement dynamically but it was not supporting.

Kindly give me pointers.

Thanks