I have a bunch of queries that I would like to dump directly to CSV. Everything works great EXCEPT there is no option to include the column names from the query (not necessarily the same as the underlying table column names). From looking around, it appears that doing a union with the column names is the only way to do what I want. My problem is:
How can I programmatically get the column names from my query?
The column names are not the same as the underlying table, so I cannot use the Information Schema.
Please let me know if you have any ideas or a better way to accomplish what I'm doing!
Thanks!
There's an article here:
http://giantdorks.org/alain/export-mysql-data-into-csv-or-psv-files/
That talks about sending SELECT output directly to a file and then modifying the text until it becomes a valid csv file. That seems to support column headers from the select statement.
Related
I've got a lot of data in an Excel sheet that I need reformatted. I am trying to achieve this by using Pivot Table but I'm not sure it is possible.
Here is current data set (SKU is unique currently):
I need it to look more like this (where SKU is NOT unique):
I'm willing to throw my current sheet into a MySQL database and query it if I can figure out a good query to utilize as well.
Any ideas on where to go from here would be appreciated.
It looks like you're wanting to unpivot your data (i.e. turn it from a crosstab into a flat file), although some of your desired output looks weird. Look at my answer to this question: convert cross table to list to make pivot table
I have a table that I need to update each day. The data comes in a text file every time. I wrote a program that extracts the data from the text file and and writes it in the table, but now I want to modify it to just update the existing data. The data is mostly the same, it might differ only a few things.
I was thinking about MERGE but I don't know very well how I could use this in my program. All the examples that I saw used a second table.
So it would be like creating a second table in which I extract the current data, after which I make the merge into the old table to update the records. I want to avoid creating a second table, so I was wondering if there is any way to do this?
Thanks!
I'm starting to learn Talend and I'm facing this problem: I have several ID's as an input and I want to make a lookup for each of these ID's to output the obtain data in a Json output.
Here's an image showing what I want to achieve:
http://i.stack.imgur.com/GLVLf.png
I have a tXMLMap with a lookup to the table where I want to find the villains from the villainID's list. The image shows how I can get the ID and Name for one of the villainID's and output it in it's respective json field but this method only works for one ID lookup at a time.
What's the best way to achieve this?
Thanks!
You should be able to copy your second input table 8 times and link all of those back into the tXMLMap component and link those by key as you already have done and join those up to where it needs to go in the XML mapping.
Alternatively you could use a tMap component in a previous step and use that to generate waveNvillainN's dispName by joining the id of your lookup table to all of the waveNvillainN's ids. This should then leave you with all of the necessary fields to populate the XML mapping.
This is the way I could find out to solve this issue, I think it's the same that #garpitmzn and #ydaetskcoR meant but I'm not sure. This works perfectly and was easy to implement but I'd just hope there was a way to have less clutter of components.
http://i.stack.imgur.com/x3AHM.png
http://i.stack.imgur.com/PBeZn.png
just facing a little problem right now.
I have a layout-table that contains one field pages. This should specify for which pages the layout should be applied.
The possible contents are "closed" ranges like '3-5' or open ranges like '3-*'. But it should also be possible to add single pages.
So is there a good way to accomplish a content like that
'3-5;11;15;17-*'
in a single field?
Or do you know better ways?
Is there a possibility to query this field like
SELECT * WHERE IN_RANGE(pages, '5') (Pseudo-Code)
I want to prevent creating a table page because it would contain nothing else and also don't want to do the validation in php.
I am happy to provide more information if necessary.
This is a tricky question i dont see "native" sql option for this.
My first idea was to store information about pages as varchar and implement method to tokenize that string so youll have values which you can then process by sql query.
I have two excel source 1st is giving me date value and 2nd is giving me price value from excel sheet.
Now i need to insert these two values into one table please tell me how can i do this?
I have used merge join but it is giving me error input must be sorted that i can't as it excel file.
Well personally, I would put each Excel file into it's own staging table. Then I would use a SQL query that joins the two tables as the source for my insert to the production tables.
After you get the input from each source, you have to sort it prior to merging it.
You can sort the input from an Excel source, from any source, because the sort is performed with the data on memory. Its an element in the Toolbar.
Check this:
http://msdn.microsoft.com/en-us/library/ms137653.aspx
I'm pretty sure you can define a sort on an excel