Column Joining and Mapping with data formatting - merge

I have 3 queries.
I need to join(merge) 2 columns in a table(there are 2 different columns in the table, need to merge them as one), kindly help with the syntax
I need to map accounts in a table but the issue being there is no unique identifier, the 2 columns are of same brand alcohol but the issue being the same alcohol has different name in different websites.
I am trying to move data from excel to snowflake but in few rows the data are of this format Meiomi Rosé, so the subsequent rows are not getting loaded and i tried to use REPLACE_INVALID_CHARACTERS 'True' but it is showing error.
Tried multiple syntaxt such as
alter table sales_ws merge SUPPLIER_VOLUME and VOLUME_UNITS;
alter table sales_ws 'join' (SUPPLIER_VOLUME, VOLUME_UNITS) AS Quantity;
tried to use REPLACE_INVALID_CHARACTERS 'True' within file format but did not work

Related

Isolating same data in Alteryx workflow

I have a large set of data, however below shows only 4 entries. I want to isolate the rows that have the same entries. For instance, on table one you can see that the first two rows have the same value in the columns number, ID, Brand, and Partner. I want to only get the rows with these same entries, so my final result will be Data Table 2.
Data Table
Data Table 2
This is the quickest way I can think of
https://drive.google.com/file/d/1Ufbl6J-gwCi5OpqaGHmC93aHuA6g-gSi/view?usp=sharing
Actually, I've just realised the 'RecordID' is redundant so you can leave that tool out, I think?

How do you insert part of an exsisting column record into a new table in postgreSQL?

I'm in the process of formatting a database and have found a column I'd like to format. It has 3 types of information for every record in the column. For example, a record in my history column shows as (American, born Estonia. 19011974). What I want to do is put this data into new individual columns to make them atomic. I want to extract data such as 'American' into a country column, 'Estonia' into a born column and '1901' into a born column and '1974' into a death column. UPDATE: However, some of the columns hold nullls, for example, another record in the same column might be (German, 19242004), so a normal regular expression wouldn't work for all data would it? Any help is appreciated!
What PostgreSQL statements would I use to obtain specific parts of this data from the individual records? I understand it would be insert and have already came up with:
INSERT INTO historian (id,url)
SELECT object_id, url FROM maintable;
that statement allowed me to get those values into new columns, but those were atomic already so I could easily transition them. Thanks for any help! :)

Insert multiple records into fact table based on fields in single record

I'm working in Pentaho 4.4.1-GA (Kettle / PDI). The database is Postgres.
I need to be able to insert multiple records into a fact table based on the fields that come from a single record. The single record contains fields:
productcode1, price1
productcode2, price2
productcode3, price3
...
productcode10,price10
So if there was a value for each of the 10 productcode / prices then I'd need to insert a total of 10 records into the fact table. If there were values for 4 of the combinations, then I'd need to insert 4 records into the fact table, etcetera. All field values for the fact records would be identical except for the PK (generated by sequence), product codes, and prices.
I figure that I need some type of looping construct which would let me check whether or not a value was present for each productx field, and if so, do an insert/update step on the fact table with the desired field values. I'm just not sure how to do this in Pentaho.
Any ideas? All suggestions are welcome :)
Thank You,
Rakesh
Could you give a sample input and output for your scenario??
From your example data I can infer that if there are 10 different product codes and only 4 product prices you want to have 4 records inserted into your table. Is that so?
Well for a start you can add a constant value of 1 to those records by filtering for NOT NULL and then use an Group BY Step to count the number of 1's. This would give you the count. BTW it would be helpful if you could provide more details on what columns you would be loading as there are ways to make a PDI transformation execute multiple times

2 Table Rows per 1 Database Table Row

I'm working on a table in iReport designer where I pull in info from a database. As of right now, I have it so that one row of the table corresponds to one row in the database.
How can I make it so that one entry in the database can take up two rows. The first row would have 4 columns corresponding to a field in the database. The second row would have 1 column the same length as the 4 above columns combined and also correspond to one field. When editing an iReport designer table, there doesn't seem to be an option to add more rows, only columns.
I found a much easier workaround. I created a one column table, then dragged and dropped static text and fields in certain spots to make the report look like it had multiple columns.

Joining two datasets to create a single tablix in report builder 3

I am attempting to join two datasets in to one tablix for a report. The second dataset requires a personID from the first dataset as its parameter.
If i preview this report only the first dataset is shown. but for my final result what i would like to happen is for each row of a student there is a rowgrouping (?) of that one students modules with their month to month attendance. Can this be done in report builder?
The best practice here is to do the join within one dataset (i.e. joining in SQL)
But in cases that you need data from two separate cubes(SSAS) the only way is the following:
Select the main dataset for the Tablix
Use the lookup function to lookup values from the second dataset like this:
=Lookup(Fields!ProductID.Value, Fields!ID.Value, Fields!Name.Value, "Product")
Note: The granularity of the second dataset must match the first one.
We had a similar issue and that can be resolved this way.
First of All, ensure the first data set's query and second data set's query are working fine by executing separately on the Database client tool such as Datastudio.
Build two data sets on SSRS tool with the respective queries and make sure both the data sets have same key column (personID).
On the SSRS report design, create a table from tool box and add the required columns from the first data set along with the matching key column(personID). Add a new column and use look up function to get the required column from the other data set against the same key column (personID).