netezza

Netezza not supporting sub query and similar… any workaround?

两盒软妹~` 提交于 2020-01-07 07:24:09
问题 I'm sure this will be a very simple question for most of you, but it is driving me crazy... I have a table like this (simplifying): | customer_id | date | purchase amount | I need to extract, for each day, the number of customers that made a purchase that day, and the number of customers that made at least a purchase in the 30 days previous to the current one. I tried using a subquery like this: select purch_date as date, count (distinct customer_id) as DAU, count(distinct (select customer_id

Joining Transaction Tables and Populating Null Values in Netezza / PDA

ぐ巨炮叔叔 提交于 2020-01-07 06:35:08
问题 I've got two transaction tables in Netezza set up like the below. When joining the tables on ID and transactionCount, and trying to return Answer, there will be nulls for row 9998, 9996, 9995 etc. How would I return all transactionCount values with the Answer column populated with the last result? So for example 9998 would return U, 9996 onward would return Y, 9988 would return N, and so on. ID transactionCount ID transactionCount Answer 1 9999 1 9999 U 1 9998 1 1 9997 1 9997 Y 1 9996 1 2

Session Duration and Time on Page calculation using SQL

a 夏天 提交于 2020-01-06 16:54:32
问题 I have some data in web_event table of Netezza in this below format. vstr_id | sessn_id | sessn_ts | wbpg_nm V1 | V1S1 | 02-02-2015 09:20:00 | /home/login V1 | V1S1 | 02-02-2015 09:30:00 | /home/contacts V1 | V1S1 | 02-02-2015 09:50:00 | /home/search V2 | V2S1 | 02-02-2015 09:10:00 | /home V2 | V2S1 | 02-02-2015 09:15:00 | /home/apps V2 | V2S2 | 02-02-2015 09:20:00 | /home/news V2 | V2S2 | 02-02-2015 09:23:00 | /home/news/internal This is my source table. I am trying to use that web_event

Session Duration and Time on Page calculation using SQL

。_饼干妹妹 提交于 2020-01-06 16:54:03
问题 I have some data in web_event table of Netezza in this below format. vstr_id | sessn_id | sessn_ts | wbpg_nm V1 | V1S1 | 02-02-2015 09:20:00 | /home/login V1 | V1S1 | 02-02-2015 09:30:00 | /home/contacts V1 | V1S1 | 02-02-2015 09:50:00 | /home/search V2 | V2S1 | 02-02-2015 09:10:00 | /home V2 | V2S1 | 02-02-2015 09:15:00 | /home/apps V2 | V2S2 | 02-02-2015 09:20:00 | /home/news V2 | V2S2 | 02-02-2015 09:23:00 | /home/news/internal This is my source table. I am trying to use that web_event

Is a collocated join (a-la-netezza) theoretically possible in hive?

佐手、 提交于 2020-01-04 14:16:40
问题 When you join tables which are distributed on the same key and used these key columns in the join condition, then each SPU (machine) in netezza works 100% independent of the other (see nz-interview). In hive, there's bucketed map join, but the distribution of the files representing the tables to datanode is the responsibility of HDFS, it's not done according to hive CLUSTERED BY key! so suppose I have 2 tables, CLUSTERED BY the same key, and I join by that key - can hive get a guarantee from

Netezza CSV load

◇◆丶佛笑我妖孽 提交于 2020-01-04 04:38:06
问题 We are new to netezza and currently trying to import a CSV file, via script, into netezza. What is the best way to get this working. Ideally we would like to 1) Create the table structure we want 2) Import the CSV and map the CSV column names to the stucture we want all in one import. This code brings back the error: count of bad input rows reached maximum INSERT INTO DBO.TABLE SELECT * FROM EXTERNAL 'C:\\log\\FILE.csv' USING ( DELIMITER ',' MAXROWS 300 logdir 'C:\log' SKIPROWS 1 Y2BASE 2000

netezza nzload similar function to isnumeric?

牧云@^-^@ 提交于 2019-12-31 02:58:07
问题 I have data from a flat file that I am loading into netezza via nzload . Some of the field types are numeric however, the data received can sometimes contain invalid characters. How can i check to make sure that the data isnumeric in my import? I saw try_cast for T-Sql but didn't see anything similar in netezza. 回答1: Netezza doesn't have an equivalent to try-cast , you can however test if the value is numeric a few different ways. If you have the SQL Extensions Toolkit installed you can use a

How to replace escape character in Netezza column

孤街浪徒 提交于 2019-12-25 09:26:17
问题 I am trying to replace escape character in Netezza column, but it is not properly replacing. Please help me some one on this. select replace('replaces\tring','\','\\\\'); I need output as replaces\\\\tring . Below is the error message i am getting... ERROR [42S02] ERROR: Function 'REPLACE(UNKNOWN, UNKNOWN, UNKNOWN)' does not exist Unable to identify a function that satisfies the given argument types You may need to add explicit typecasts Thanks in advance. 回答1: This is because REPLACE

Next value function error

為{幸葍}努か 提交于 2019-12-25 05:28:11
问题 I get the following error during postgresql execution: ERROR [HY000] ERROR: you can only use a 'next value(s)' function within a target list What is wrong with this sql statement: SELECT TRFCON.ID , case when DDDCON.ID_CON = 0 then NEXT VALUE FOR SEQ_DDD_CON else DWHCON.ID_CON end ID_CON FROM TTT_CONSUMPTION TTTCON join DDDDWH_CON DWHCON on TTTCON.ID_ORG = DDDCON.ID_ORG and TTTCON.ID_PRO = DDDCON.ID_PRO and TTTCON.ID_REF = DDDCON.ID_REF The DDL of the sequence is the following: CREATE

how do I convert mmyy to last day of month in netezza

别等时光非礼了梦想. 提交于 2019-12-25 02:22:02
问题 One of my column needs to be transformed into a date field. It contains a value that gives the YYMM and it should be translated into the last day of that month: For example, 1312 should become 12/31/2013. I have tried various last_day, to_char functions but not able to convert 1312 in a date format. Please help !! 回答1: Netezza is based on Postgres, so maybe the Postgres method will work. Here is Postgres code that works (see here): select to_date('1312'||'01', 'YYMMDD') + interval '1 month' -