#DateForumTypeThreadPost
1315 Jun 2015 @ 07:21 PDTDatabaseReplyTeradata valid date check without udfJust with case  (returns valid date or null in case invalid date) (CASE WHEN SUBSTR(DATE_COLUMN,9,2) BETWEEN '01' AND '31'          AND SUBSTR(...
1220 Oct 2014 @ 06:27 PDTGeneralReplyCould anyone pls tell me how can we get sorted results without using order by clauseI don't understand why you do not want to use order by ..   but id you add  at the end of the SQL   qualify csum(1,  column_1 (desc) , column_2 (desc) , ...) > 0...
1129 Sep 2014 @ 08:13 PDTDatabaseReplyTuning LIKE OperatorTry,   create another table (and mantain it, when loading t1) create table aux_t1 (id integer not null, end_dt date not null, col1 VARCHAR(100), col2 VARCHAR(100)) unique primar...
1019 Dec 2013 @ 07:16 PSTDatabaseReplyjoining two tables using SUBSTRTry this one:   sel * from tb1 a , tb2 b where b.cntry_code like '%'||trim(a.cntry_code)||'%' ; You will get these pairs: a.cntry_code    b.cntry_code ...
913 Dec 2013 @ 05:50 PSTDatabaseReplySyntax error: expected something between '(' and the 'current_date' keyword.try,   SELECT s22.wk_dt FROM attr_table s21 CROSS JOIN TIME s22 CROSS JOIN (SELECT day_of_week FROM sys_calendar.CALENDAR WHERE calendar_date = CURRENT_DATE) AS a WHERE (s21.DC_LOC...
809 Dec 2013 @ 06:41 PSTDatabaseReplyWhom can help me explain the ‘46.06:18:08’ time.I have TD 14.00 and using SQL assistant 14.01 Running   SELECT CAST( '11:10:25' AS TIME(0)) - CAST('11:00:33' AS TIME(0)) HOUR TO SECOND ;   I get  as answe...
709 Dec 2013 @ 06:34 PSTViewpointReplyUsers Online at a particular time durationYou can try Eg.  active sessions today between 9:00:00 and 9:30:00 SELECT  username, sessionno, logdate, MAX(CASE WHEN event ='logon' THEN logtime ELSE NULL END) AS tim...
609 Dec 2013 @ 03:54 PSTDatabaseReplyTeradata sql grouping To obtain ththe output as you have indicated, the sql: SEL VENDOR, COALESCE(LOCATION,'TOTAL ') AS LOCATION , SEPT, OCT, TOTAL2013 FROM ( SEL VENDOR, LOCATION, SUM(CASE WHEN...
505 Dec 2013 @ 03:42 PSTDatabaseReplyWhom can help me explain the ‘46.06:18:08’ time.when you wrote SELECT CAST( '11:10:25' AS TIME(0)) - CAST('11:00:33' AS TIME(0))  you are missing HOUR TO SECOND You should write   SELECT CAST( '11:10:25' A...
404 Dec 2013 @ 03:54 PSTDatabaseReplyTranspose rows to columnstry,   select id, name,    max(case when subjkect ='Maths' then msk else null end),  max(case when subjkect ='Science' then msk else null end),  max(ca...
304 Dec 2013 @ 03:41 PSTDatabaseReplyWhom can help me explain the ‘46.06:18:08’ time.  You are really substracting two integer numbers not two "time" columns. So you are doing  111033- 1100025 and display the result in the formnmat '99:99:99' You are ...
212 Nov 2013 @ 07:43 PSTDatabaseReplyMove column data as rowstry, select id, max(case when name ='a' then value else null end) as A, max(case when name ='b' then value else null end) as B, ..   from  table group by 1   ...
112 Nov 2013 @ 04:45 PSTDatabaseReplyRecursive queryTry, WITH RECURSIVE REC_TBL ( emp_id, boss_id ) AS (SELECT emp_id, (boss_id) AS boss_id FROM employee_tbl UNION ALL SELECT a.emp_id, b.boss_id FROM REC_TBL A , employee_tbl b ...