Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Writing SQL to create view

Status
Not open for further replies.

amfromhyd

Programmer
Oct 14, 2011
1
US
Hi, I am new SQL. I am writing a query to create a view from below tables;
Person, Person_address, Address, Org, Org_address, Person_org.
Person, Address, Org are base tables, and Person_address, Org_address, Person_org are associate tables.
Person: Person_id, Person_Name
Org: Org_Id, Org_Name
Address: Address_id, Line1,Line2, City, State, country, City
Org_address:Address_id, Org_id, Eff_dt, End_dt
Person_address: Person_id, Address_id, Eff_dt, End_dt
Person_org: Person_id, Org_id, Eff_dt, End_dt

Now I want to create a denormalized view to give snapshot of a person as of today with Person name, org name, person address, org address. I really appreciate any help.

Database: Teradata

 

Create the query you want using the GUI interface.
Switch to SQL view to see the code.


Randy
 


you criteria for "as of today" would be something like
Code:
where ...
   and Org_address.End_dt is null
   and Person_address.End_dt is null
   and Person_org.End_dt is null


Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top