Skip to content

Tag: sql

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_…

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…

How to ungroup the grouped record based on count column using SQL

I have below data set obtained after group by dept and loc. dept id loc count 100 a 2 300 c 1 I need out put like below deptid loc 100 a 100 a 300 c please help Answer Another option is to use Recursive Queries to get the desired result. DB Fiddle Link: https://dbfiddle.uk/?rdbms=oracle_18&fiddle=0580680e…

Unique Indexes query for HSQLDB

I’ve got a query that selects unique indexes from a MySQL DB table: I am looking to create the equivalent query that works for HSQLDB Any help is much appreciated! Answer That’s available in information_schema.system_indexinfo

sql – union tables with same prefix

I have a set of tables with same prefix and same structure. All I need is to “combine” them as one. Basically I retrieve tables with certain pattern from information_schema.tables, then get rid of the last union all. Above method works for 20-30 tables, as the @result won’t exceed the limit …