Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have following tables
tbl_items--> ID,name,price
tbl_customers--> CustId,custname
tbl_sales--> Id,custId,Itemlist,totalprice

I have a proc that stores the record of items bought by each customer in a single row
for eg if customer(custID=1001) buys 3 items(item id 1,2,3) then the record is stored in a single row in tbl_sales as
1~ 1001~ 1,2,3 ~sum of price

now what i want is to show this record like

"customername" ~ "item1,item2,item3" ~ $600.

how can i get this.
i have tried
SQL
select cus.name,amt.billamount,(select name form tbl_items where ID in cus.Itemlist)
 from tbl_customers cus join tbl_daily_sales_amount amt
 on cus.customerId=amt.customerID


an so on.. but i cant get the rdesired output
pls help me with this.
Posted

1 solution

There are some possible solutions to do this. You can have a look here to find out:
http://blogs.technet.com/b/heyscriptingguy/archive/2011/11/28/four-easy-ways-to-import-csv-files-to-sql-server-with-powershell.aspx[^]

Good luck!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900