I have 2 tables Details,Mstr.
Mstr table contains(PSNO,NAME,DOB,DOJ)=>PSNO- PK
Details(PSNO,NAME,PH,SAL_ACC,ADV,DT_PREP)PSNO-FK
In Grid i need to display
SAL_ACC NAME ADV DT_PREP
12345 abc 150 5/25/2009
12345 abc 300 5/30/2009
12345 abc 200 6/11/2009

how do i do ths,please help

Recommended Answers

All 6 Replies

Unless I am misunderstanding you, all of your fields are in the details table, No need for a join.

Good Luck

try the following

select b.SAL_ACC ,b.NAME ,b.ADV ,b.DT_PREP from mstr a,detail b where a.psno=b.psno

try the following

select b.SAL_ACC ,b.NAME ,b.ADV ,b.DT_PREP from mstr a,detail b where a.psno=b.psno

As vb5prgrmr pointed out, a join is not even necessary because all the data can be obtained from one table.

But how can i display d results in the grid,that i dnt knw

There can be 15 rows belonging to same person,but with different PREP_DT,i need to show all of then,like i have mentioned earlier,this i dnt know,thats why i made PSNO as foreign key in Details table as a single PSNO vil be having more than 1 records,and i need to display all of them.....

As vb5prgrmr pointed out, a join is not even necessary because all the data can be obtained from one table.

what if i want only matching data based on both the tables ?

in that case a join is compulsory.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.