indian_sumesh
15th October 2010, 10:02
Hi,

I wants to know if i have to get data from multiple companies and the select statement includes also more than one table then how the statement can be written to get correct results.

eg.
1) select tdsls041.*, tiitm001.*
from tdsls041, tiitm001
where tdsls041.itm refers to tiitm001
and tdsls041._compnr = 200
and titm001._compnr = 200

or

2) select tdsls041.*, tiitm001.*
from tdsls041, tiitm001
where tdsls041.itm refers to tiitm001
and tdsls041._compnr = 200

which eg. is OK?

Pls help

Thanks
Sumesh

vinceco252
15th October 2010, 16:56
Statement 1 should select data for both tables from company 200 regardless of the company the user is logged into.

Statement 2 would select tdsls041 data from co 200 and tiitm001 data from whichever company the user is logged into.

Vince

SujithKumar
15th October 2010, 23:26
try
and tdsls041._compnr = "200,205"
and titm001._compnr = "200,205"

Assuming you want to pull data from companies 200 and 205.

Hitesh Shah
16th October 2010, 18:11
Also compnr condition should be specified before all other conditions . It can also be written with IN specification [ compnr in (1,2 ) ].

And as db driver uses actually compnr specification to create multiple queries for underlying databse, u can not have any illogical condition combined with compnr condition.