April 6, 2009 at 10:17 am
Hi All,
I need help with writing this query on SLQ server 2005. Basically, my data in the "type" field (carrier_insurance.type) has multiple values i.e. auto liability, worker's compensation, general liability, etc.
I want to split the values and represent it in different columns as one carrier can have multiple insurance types.
Below is my query so far:
SELECT Carrier.[Key], Carrier.CreateDate, Carrier.Name, Carrier.Uid, Carrier.City, Carrier.State, Carrier.Zip, Carrier.IsW9Verify, Carrier.IsContractOnFile,
Carrier.ComplianceStatus, Carrier.InsuranceValue, Carrier.CarrierOfferValue, Carrier.CoverageValue, Carrier_Insurance.[Key] AS Expr1,
Carrier_Insurance.Type, Carrier_Insurance.CarrierKey, Carrier_Insurance.Limit, Carrier_Insurance.CarrierName, Carrier_Insurance.ExpireDate,
Carrier_Insurance.VerifyDate, Carrier_Insurance.Date, Carrier_Insurance.IsContractOnFile AS Expr2, Carrier_Insurance.ContractDate,
Carrier_Insurance.Note, Carrier_Insurance.BrokerName
FROM Carrier INNER JOIN
Carrier_Insurance ON Carrier.[Key] = Carrier_Insurance.CarrierKey
I would appreciate any help.
Thanks.
April 6, 2009 at 10:24 am
Hi
Could you please provide table structures.
If you want to convert rows into columns then you can try out PIVOT.
April 6, 2009 at 1:43 pm
Confirm Vijaya Kadiyala. DDL and some sample data would be helpful to help. 😉
Please have a look to the link in my signature.
Greets
Flo
April 6, 2009 at 2:37 pm
Hi
Sample data is very much required like "what is the input" and "what is the out put" you are looking for. 🙂
April 6, 2009 at 8:28 pm
Hi All,
Attached is sample data in excel file. I want to display the colored data in column K,L & M as a single row. Please help me.
Thanks,
Vishal
April 6, 2009 at 11:29 pm
vishal.chawla (4/6/2009)
Hi All,Attached is sample data in excel file. I want to display the colored data in column K,L & M as a single row. Please help me.
Thanks,
Vishal
I, for one, don't have Excel 2007 so that's pretty useless. Also, you really need to read the link that Flo directed you to because some of us won't even touch an Excel spreadsheet for data.
The reason why folks ask for the particular format identified in the link that Flo directed you to is so they can actually test their solution using your data to make sure you have the best answer possible... without having to go through the pain of converting a spreadsheet. Not trying to give you a hard time... trying to get you a better answer.
--Jeff Moden
Change is inevitable... Change for the better is not.
April 6, 2009 at 11:31 pm
Actually, I got a blank page on Flo's link... a working link exists in my signature line below. Do yourself a favor and read the article attached to it.
--Jeff Moden
Change is inevitable... Change for the better is not.
April 7, 2009 at 7:24 am
Am not a sql expert and I used the excel 07 file as an attachment for sample data as it was one of the file type options. Am reattaching the sample data in xls. format.
April 11, 2009 at 12:51 pm
vishal.chawla (4/7/2009)
Am not a sql expert and I used the excel 07 file as an attachment for sample data as it was one of the file type options. Am reattaching the sample data in xls. format.
It's been a couple of days and, as you can tell, not too many folks are biting on your problem. Answers would probably come quicker and better if you did like I suggested. Read the link in my signature below and post the table definition and the readily consumable data that way and you'll have much better luck. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply