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.
Author |
Topic |
Calleman87
Starting Member
2 Posts |
Posted - 2014-08-22 : 07:23:39
|
Hi all!New to all this SQL-thing. I'm running a joint company with a friend of mine and we are trying to extract a bunch of data from our tables. I've managde to retrieve the data that we want out of an order table, but I can't make it export the way I want.We have two tables with information that we want to extract.The code we've written looks like this:"SELECT o.id_order, o.reference, o.id_customer, o.payment, od.id_order_detailFROM ps_orders oLEFT JOIN ps_order_detail od ON (od.id_order = o.id_order)"It gives us a result that looks like this:8 12345 78 PayPal ProductName8 12345 78 PayPal ProductName8 12345 78 PayPal ProductName9 12789 60 PayPal ProductName9 12789 60 PayPal ProductName9 12789 60 PayPal ProductNameSo extracting the data is not an issue (from what I feel) I would like it to be:8 12345 78 PaypalProductNameProductNameProductName9 12789 60 PayPalProductNameProductNameProductNameWhat code would you recommend me to use to export the data in the format written above?Thank you in advance! |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-08-22 : 12:25:37
|
This should be handled by the application layer, whether it be your program or a report. Return raw data from SQL, and let the application layer handle the formatting.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
Calleman87
Starting Member
2 Posts |
Posted - 2014-08-22 : 13:32:30
|
Hi Tara! Thanks for replying! I'm not really sure what you mean by application layer, but I'm taking a wild guess here, (after all, as an accountant by trade, I must be forgiven, right? ;)) the application which will be used to import into is of strict format. The manufacturer of the program clearly specifies that an import .csv file should be arranged in a certain order, otherwhise the import will fail. Hence the need to extract data from database and present it in a certain order. What i'm asking about is non-achievable? |
|
|
|
|
|
|
|