Input :
Output i want :
So i have 3 rows AND 1 column and it's always in the same column from Excel file.
I will always have 3 column and i want convert that into 1 rows and 3 column.
How can i do that ?
Thank you!
You could achieve this with simple tMap and tAggregaterow. You'll have to get a fixed schema on your output, but as I understood this will be the case .
(firstname/hours/lastname)
tMap : for each output field, put the value of column B if column A matches name of output column. else null.
tAggregate to compress data to one single row using 'max' operation.
Related
I want to use lookup transformation for 2 columns at the same time in SSIS. For example, if there are 3 columns ProductID,CreatedDate,Pname I need to compare 2 columns say ProductID and CreatedDate at the same time so that only if a row has same ProductID but different Created Date it should go in no match output. Currently my transformation is just using productid and if its already exists, it is putting in matched rows even after having a different CreatedDate.
As per above example, both ProductID with 1 should be there in no match output.
How can we implement this in SSIS?
It's very simple. Currently I believe you have only source.ProducID mapped to destination.ProductID in lookup.
All you need to do is map source.CreatedDate to destination.CreatedDate.
You need to do something like this :
I have a matrix/tablix set up so there are 4 row groups going down the left-hand side and a column group called RegCompCategory:
When the report is run, the RegCompCategory column group produces 3 distinct columns based on the categories in the underlying data:
What I'd like to do is add another column before the RegCompCategory column group that will display a percentage of the "fully-marked" column against the "total" column:
I'm guessing I will need to write an expression for the fields highlighted above, but I'm not sure how to reference the RegCompCategory to identify specifically the "Fully-Marked" category of data.
Could someone give me a few pointers? Many thanks.
Try:
=Count(IIF(Fields!RegCompCategory.Value="Fully-Market",Fields!RegCompCategory.Value,Nothing))
/
Count(Fields!RegCompCategory.Value)
It will count the number of Fully-Market rows and divide by the total rows. I think that is what you are expecting.
Let me know if this helps you.
I wonder if it is possible with MySQL. I output the result of my "select" query. The result is always one single row. What I want is to output only columns with values not equal to 0. I do not want the user to see everything because lots of columns in the row are 0 and thus not interesting for him.
Example row:
column name: a b c d e f
column value: 1 6 0 6 7 0
I do not want columns c and f to appear in the result.
Can that be achieved in SQL resp. MySQL? Or do I have to perform additional processing of SQL result with some programming language like PHP?
Best regards
Ewgenij
You can't have dynamic columns with a static query.
The only way to have dynamic columns in MySQL is with a stored procedure (which will have to build a query as a string and run it).
I have a table with 100 columns.
It happens that I want the query to show only the columns that have "value <> 0"
So the column that has val = 0 should not be displayed.
Can anyone help with this
You can have a query like the following:
SELECT FLOOR(SUM(IF(column1 IN (0),0,1))/COUNT(*)),FLOOR(SUM(IF(column2 IN (0),0,1))/COUNT(*)),...,FLOOR(SUM(IF(column100 IN (0),0,1))/COUNT(*)) FROM table_name
This will give you a row with column value = 0 if the column contains 0 and 1 if column contains no 0.
You cannot adjust the number of columns returned. That is defined by a projection (your SELECT block) and a projection is evaluated against the table schema. It is expected that you know the number of columns and the types that you want returned in a projection.
As the previous user had mentioned, you can use a function or case statement to change the value in the column, or alternatively, you can restrict the rows returned with the WHERE clause (if some value or values are <> 0, for example).
The schema of the generated projection table returned must be static though.
Is there a way to get a specific row based on a columns value?
Say I have a column 'name' which has a unique value and I want to get an entire row based on that single value. For example, say I have a row defined by three columns 'name' 'city' and 'state' and want to get all three columns associated with that row only using the value 'Jeremy' found in the 'name' column.
I know I can do this by selecting all rows and use if statements to break down the rows to find what I am looking for but I am also sure there must be an easier command through MySQL to achieve this.
Isn't it as simple as this? This is a basic filtering :D
SELECT name, city, state
FROM tableName
WHERE name = 'Jeremy'