Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQL Query from different Tables

Author  Topic 

Wamalwa
Starting Member

2 Posts

Posted - 2012-05-22 : 04:48:09
Dear Experts,

I have a scernario where i want to retrieve data from 5 tables:
OVPM - Doc Num,Doc Type,Doc Total,Journal Remarks,Cash A/C
VPM4 - Doc Num,Row Num,Account,Paid,Description,Acc Name, Pay type
OACT - Account Code,Account Name
OPCH - Doc Num,Doc type,Doc Total, Journal Remarks
PCH1 - Doc Entry,Row Num

I don't wish to have duplicate data.
Please kindly help me.

Thanks,
Wamalwa

vinu.vijayan
Posting Yak Master

227 Posts

Posted - 2012-05-22 : 04:54:38
This can be done by Joining the three tables.
But for anyone to help you....you would have to help them by posting sample data for all the three tables and also tell us the related fields in the tables.

Please help us in helping you.

N 28° 33' 11.93148"
E 77° 14' 33.66384"
Go to Top of Page

Wamalwa
Starting Member

2 Posts

Posted - 2012-05-22 : 05:04:36
Thanks Vijayan,
Am new here, how can i send the sample data. Is there any way to attach or paste a snaphot screen?
Go to Top of Page

Ashwanixtra
Starting Member

1 Post

Posted - 2012-05-22 : 05:41:03
Don't send the data...just paste some sample rows from all of the tables...say 5 rows per table
Go to Top of Page

vinu.vijayan
Posting Yak Master

227 Posts

Posted - 2012-05-22 : 07:41:32
quote:
Originally posted by Ashwanixtra

Don't send the data...just paste some sample rows from all of the tables...say 5 rows per table



+1.
The following link will tell you how to post on forums.

quote:
http://www.sqlservercentral.com/articles/Best+Practices/61537/


Copy and paste the url in your browser. Go through the article and then post it like shown in the article.

N 28° 33' 11.93148"
E 77° 14' 33.66384"
Go to Top of Page
   

- Advertisement -