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
 Date on one line

Author  Topic 

werhardt
Constraint Violating Yak Guru

270 Posts

Posted - 2008-01-08 : 11:06:04
I have this report that I am trying to create, below is my statement. My problem is that the billing address and provider address is in the same field. I wanted to create another column as I did called “BillingAddress1” so that I can have the Prodider address on the same line as the billing address, is this possible? How does it work?

Here is an example of my data.

I want to keep the Provider office in the provider column which is fine(300 Community Dr), but I want to have the billing address (P.O. Box 5200) to be in the Billingaddress1 column on the same line as the provider address. Can this be done? Even though we are working from the same field?


Select Distinct
p.pro_id1,
p.PRO_TAX1 as "TaxID",
p.Pro_XTYP as "ProviderType",
p.Pro_XTYP as "ProviderTypebill",
p2.Pro_XTYP as "ProviderTypebill",
p.PRO_Office as "PracticeName",
p.Pro_Lname as "ProviderFirstName",
p.Pro_Fname as "ProviderLastName",
p.Pro_sys as "System affiliate Field367",
--v.val_desc,
p.pro_pcs as PCS#,
p.pro_spec1 as "Specialty1",
p.pro_spec2 as "Specialty2",
p.pro_spec3 as "Specialty3",
p.pro_spec4 as "Specialty4",
p.pro_degree as "ProviderDegree",

p.pro_addr1 as "ProviderAddress1",
p2.pro_addr1 as "BillingAddress1",

p.pro_addr2 as "ProviderAddress2",
p2.pro_addr2 as "BillingAddress2",

p.pro_city as "ProviderCity",
p2.pro_city as "Billing Address2",

p.pro_state as "ProviderState",
p2.pro_state as BillingState,

p.pro_zip as "ProviderZip",
p2.pro_zip as "BillingZip",

p.pro_phone as "ProviderPhone",
p.pro_fax as "ProviderFax",
p.PRO_BTAG
--pro2.PRO_BTAG
---Need Billing address, billing city, billing zip



FROM dbo.pro p
JOIN pro p2
ON p.pro_id1 = p2.pro_id1

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-01-08 : 11:22:35
same as this:-

[url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=94957[/url]
Go to Top of Page

werhardt
Constraint Violating Yak Guru

270 Posts

Posted - 2008-01-08 : 11:24:45
Yeah it is the same problem.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-01-08 : 11:56:25
DId you try my soln? or was ur requirement different?
Go to Top of Page
   

- Advertisement -