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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 relationing two tables and display data base on se

Author  Topic 

blocker
Yak Posting Veteran

89 Posts

Posted - 2010-01-07 : 01:26:03
Good day!

I have 2 tables(journal_summary and journal details) the field of the journal_summary is: jornaltransid,dateentered,status. In the journal_detail is:journaltransid,membername,amountpaid,balance. I want to use a query that when i search the journaltransid of the journal_summary, all data from journal_detail that has the searched journaltransid of the journal_summary will be displayed..I just cant figure out how to do this.

Thank you for giving time..

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-07 : 01:30:39
this seems like a straight forward query. can we see what you tried till now? the hint is you just need to join b/w tables on related fields.
Go to Top of Page

blocker
Yak Posting Veteran

89 Posts

Posted - 2010-01-07 : 01:47:07
Im just new to sql server. Ive just finished designing this 2 tables..I really dont have idea on joining this two tables to pull out the result.Let me try."Select journaltransid FROM journal_summary as a INNER JOIN journal_detail as b WHERE b.journaltransid=a.journaltransid"

I havent try this query..Please let me know if something needs to be modify..

Thank you for giving time.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-07 : 01:50:27
[code]Select a.journaltransid,dateentered,status,membername,amountpaid,balance
FROM journal_summary as a
INNER JOIN journal_detail as b
ON b.journaltransid=a.journaltransid
[/code]
Go to Top of Page

blocker
Yak Posting Veteran

89 Posts

Posted - 2010-01-07 : 01:55:58
thank you for changing my query. I know this works.


God bless.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-07 : 02:02:19
welcome
Go to Top of Page
   

- Advertisement -