sql - how to display parent record and children from multiple tables -



sql - how to display parent record and children from multiple tables -

i have 3 tables, 1 parent 2 kid table 1-to-many relationships. table 1: people table 2: phone numbers (any number of records) table 3: email adresses (any number of records)

i study looking this: person1: first_name-------last_name phone1:------12345----home phone2:------54321----work mail1:-------first@mail.com----work mail2:-------first@mail.com----work mail3:-------first@mail.com----work

person2: -------first_name-------last_name phone1:------12345----home phone2:------54321----work mail1:-------first@mail.com----work mail2:-------first@mail.com----work mail3:-------first@mail.com----work

i much using reporting services.

edit: know how link tables left joins, don't have concept how done.

ok, here's sort of summary of how need approach it. can't give step-by-step because impossibly long, should started. (also note i'm doing memory):

you need 3 datasets, 1 each people, phone numbers, , email addresses. going assume phone numbers , email addresses have kind of id field in common, way tie people phones , email addresses. need field in datasets.

you don't need joins in sql: linking between 3 datasets done within report.

put matrix on report. have draw people dataset. set first , lastly name in detail row of matrix.

add new detail row matrix, under first , lastly name.

merge cells in new detail row have 1 wide cell.

embed (drag , drop) new matrix in single wide cell in new detail row.

link matrix phones dataset. set record filter in matrix limit records match id field in parent matrix.

set phones want in embedded kid matrix.

repeat steps 3-7 email addresses dataset.

you don't need grouping (unless want include subtotals of kind), because you're not grouping anything: you're displaying list embedded sub-lists.

sql sql-server-2008 ssrs-2008

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -