I have one table that stores different values in one column. Lets say the structure is like: column_a: name column_b: contact_type – email or phone column_c: contact_value – exact email address or phone number Shall a person have both email and phone, there are two rows. I trying to get a select that would distribute the different values into respective
Tag: teradata
Select and skip rows by date range with checking difference between them
I’m new in Teradata and i have a small sql problem, similar to this one below : source table A: output wanted: Explanation: 1 –> if c is different (between current row and the next one) so dt_f of the current row = dt of the next row – 1 day , the two rows are selected 2–> if months_between(dt,dt)
Calculate Days Between Based on 3 Variables & Syntax Error
I’m hoping you can provide some insights on a couple of issues: ISSUE 1 – i’m receiving the following error message running in Teradata: “Syntax error, expected something like ‘)’ between an integer and the ‘then’ keyword.” There are some duplicate records in my data and what I am trying to say is if all conditions are met, then Age
I am trying to provide a ranking based on a previous partition
I am trying to change the ranking column where instead of ordering by RMSE ASC I want to order by RMSESum ASC (which was a previous partition by)….when I do this I get an error that “ordered analytic functions cannot be nested” any idea around this? Answer You should use the sub-query as follows:
How to sample from different values in a column but only return records that are unique from another column?
I am struggling with a sampling issue using Teradata Below is the format of the data I would ideally like to return a sample number for each entry in Group but with only unique values from ID. Below is the current query I produced but this returns duplicates for ID Answer
Is there a way to group rankings in SQL Teradata?
I am trying to get the ranking or grouping to count like in the custom_ranking column: I want it to count the rank like in the row custom_ranking, but everything I keep trying is counting it in the current_ranking row. I am currently using this: Answer Based on your sample data, this would be:
Teradata – How to understand data distribution?
I’ve been looking everywhere how I can improve my Teradata views performance by choosing the right primary index in my tables. I have found multiple answers pointing to the same thing, by using this query to see how data is distributed through the AMPs : I get that I need to have an even distribution, but is it better to
sql- suppressing the amount value to get the unique value when its multiple rows of same information
Sorry for the confused title. I am on Teradata 16.1, I have two tables, one is a simple table with id and amount and another one is a detailed table with sub id’s and their amounts. In the second …
SQL count distinct # of calls 6 months prior to create date
Am trying to figure out the SQL to: count # of distinct calls made on an account 6 months prior to the account being created I also need to CAST the date field. I’m thinking something like: case …
Query to deduplicate based on one columns
My data looks like this in Teradata How do I construct my sql query to pull the latest loaded data like so: Basically every field will match except the id and the load_number. So given that every field matches except those two fields, can I remove ‘duplicates’ by taking the row with the higher load_number. The data can differ in