Skip to content
Advertisement

Determine time duration based on events without using loops

I have a table with timestamps of 5 different types of events (start, stopped, restart, aborted, and completed). The given table looks like this: Time EventID Event 7:38:20 1 start 7:40:20 2 stopped 7:48:20 3 restart 7:50:20 4 aborted 8:00:20 1 start 8:40:20 5 completed 8:58:20 1 start 9:00:15 4 aborted I would like to determine the following and display

How best can I to pivot my redshift table?

I have a Redshift table called metadata with the following columns: id key value 1001 code1 my value 1001 code2 another 1001 code3 yet another 1002 code1 new one 1002 code2 here 1002 code3 last 1003 code1 hello 1003 code2 goodbye 1004 code2 now 1004 code3 then I’d like to have a query that return it as: id code1 code2

Syntax error when using input parameter to create procedure

I’m getting this error Msg 103010, Level 16, State 1, Line 1 Parse error at line: 33, column: 15: Incorrect syntax near ‘@sas_token’ For reference here are the guides I am following: https://learn.microsoft.com/en-us/azure/synapse-analytics/sql-data-warehouse/quickstart-bulk-load-copy-tsql-examples#b-shared-access-signatures-sas-with-crlf-as-the-row-terminator-windows-style-new-line https://learn.microsoft.com/en-us/azure/synapse-analytics/sql/develop-stored-procedures#stored-procedures-in-synapse-sql I tried the commented part because I thought it didn’t recognize the quotes but it still didn’t work This procedure will be called from Python like

Parse out word between two characters SQL Netezza

I am having trouble finding the correct syntax to parse out a word between two characters in Netezza. PATIENT_NAME SMITH,JOHN L BROWN,JANE R JONES,MARY LYNN I need the first name which is always after the comma and before the first space. How would I do this in Netezza? Answer I think Netezza supports regexp_extract(). That would be: Or regexp_replace():

Bigquery SQL MAX() text value

Thanks for taking the time to look at this. How to get the MAX of a text value in column A. I would like to and another where clause to show only one of the “FY20-Q4M#” (MAX value only) Current Table YY-QQ_STATUS Program FY20-Q2_ACTUALS XYZ FY20-Q3_ACTUALS XYZ FY20-Q3_BUDGET XYZ FY20-Q4M0 XYZ FY20-Q4M1 XYZ FY20-Q4M2 XYZ FY20-Q4_BUDGET XYZ FY20-Q4_OUTLOOK XYZ Goal:

Advertisement