cancel
Showing results for 
Search instead for 
Did you mean: 

how to extract data from more than one table

Former Member
0 Kudos

Hi

In case of JDBC-XI-File scenario if user want to extract data from more than one table is it possible ?? Because in the SQL Query statement place we have very small space and we can't put multiple statements there.

Please correct me my understanding is wrong and plz provide me the feasible solution for the same.

thanks

kumar

Accepted Solutions (1)

Accepted Solutions (1)

prateek
Active Contributor
0 Kudos

Hi Kumar,

You either use a select query with join or a stored procedure which will contain the logic to extract the data from multiple tables. But, the limitation in case of stored procedure is u can hv only one selct query in it.

Sample code

SELECT <Table_2>.EID, <Table_2>.FName, <Table_2>.LName, <Table_1>.REC_DAT, <Table_1>.DESCRP

FROM <Table_1> INNER JOIN <Table_2> on

<Table_1>.CARDNO = <Table_2>.CARD

where REC_DAT = <condition>

union

SELECT <Table_2>.EID, <Table_2>.FName, <Table_2>.LName, <Table_1>.REC_DAT, <Table_1>.DESCRP

FROM <Table_1> INNER JOIN <Table_2> on

<Table_1>.CARDNO = <Table_2>.CARD

where REC_DAT = <condition>

Regards,

Prateek

Former Member
0 Kudos

Hi prateek,

Thanks for the reply !! After seeing that much big sample code I have one question in my mind. That is as we have ony one line of place to keep the SQL Query in the JDBC adapter...........how to tackle this situation ??

thanks

kumar

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

This is a single line of select query. The JDBC adapter will be able to holdany select query irrespective of how long it is.

Regards

Bhavesh

Answers (2)

Answers (2)

bhavesh_kantilal
Active Contributor
0 Kudos

Like pointed by Ahmad you need to use a Join Statement.

Ask an SQL expert to frame the query for your exact requirements.

Regards

Bhavesh

Former Member
0 Kudos

hey

have a look at the following

also do a simple search on sdn with "Join tables in JDBC" and u will find loadz of information

thanx

ahmad