I have the following case statement; I would like it to return But the output I am getting is; I dont want the zeros, I would like the empty string. Answer You want to return a string, so you need to cast the else:
How do I derive a value for a column based on another column’s value?
I have a projects table like the one below. There are two slightly different id columns idx and idy–one idx can have multiple idys (for versioning). The goal is to consolidate the usage such that for every idx, the result will have: a use_count col which is SUM(use_count) for same idx the latest usage_date the name corresponding to the latest
Is it possible to insert a table type collection within a table collection in PL/SQL
I have a requirement to send back a record type in a table collection which have 2 fields- Line_id Fulfillment_set_id A line_id is always unique but a line_id can have more than one Fulfillment_set_id. So I have created a record type Is the above collection structure possible or am I missing something because I am not able to get success
Unrecognized name: error in nested query using bigquery standard sql
I am running the query where the inner statement (in this case I use when..case) and it is expected to run the query from the outer statement’s result. But, the result from the outer statement is in string datatype , so I added “as INT64” to solve this. However, the query still throw error “Unrecognized name: (score at [12:33]” Code:
How to select records in the order they were inserted, and then group them by a type
I have a query I can not seem to get to work. I have a table like this: ThingID, FK_ThingTypeID, Etc… And I want to select records in the order they were inserted, but group them by type. So if the data looks in the table is in the following order: I want to get select the records like this:
SQL filter elements of array
I have a table of employee similar to this: I want to get the department, name, and age of all employees, something similar to this: How can I achieve this using SQL query? Answer I assume you are using Hive/Spark and the datatype of the column is an array of maps. Using explode and collect_list and map functions. Note that
Subtract scanner value from sql table value
I’m trying to subtract a scanner input from a table value. Here’s a screenshot of my table: Here’s what my code looks like: The output of my code is: Here’s what I want my table to look like after subtracting 100 (my scanner input quantity): I’m unsure as to why subtracting my scanner variable (quantity) doesn’t work, and I would
can not check whether a table exists or not in postgresql
I’m writing a C program that connects to a postgreql db.I’m trying to check for a table : this variable is a global variable. but when I compile the code this error occurs: Answer If this is a global variable, C requires that it be initialized with something known at compile time; if it requires a call to PQexec(), this
Azure SQL Database Manipulation
Is it possible to create a table in an Azure sql database using Python? I am pulling a list of things from an API and then want to push them to a table in my Azure sql db but can not find a tutorial or guide on how to do so. Googling for it led me to tutorials on how
How would I find all records in a number column (Oracle) which have 3 digits in Sequence
How would I find all records in a number column (Oracle) which have 3 digits in Sequence. Would I have to use substr to break down the number to individual digits and then subtract first and second …