Is it possible to show a message before a table in MS SQL Server? Assuming this have a table of NAMES with columns firstName and lastName This code/query shows only the tables firstName and lastName without the message ‘This is a list of names’ Answer Run the query from SSMS with the Results to Te…
Tag: sql
MSSQL COALESCE function with multiple non null values
I am trying to get data (T_Stamp, Destination, Weight, Line) from two tables using variable time intervals and a destination selection. This is going into an Ignition SCADA. My SQL code below works for most cases except when there are entries into both tables with the same timestamp. In those cases it shows o…
Retrieve last record in a group based on string – DB2
I have a table with transactional data in a DB2 database that I want to retrieve the last record, per location and product. The date is unfortunately stored as a YYYYMMDD string. There is not a transaction id or similar field I can key in on. There is no primary key. DATE LOCATION PRODUCT QTY 20210105 A P1 4 …
Replace NULL values per partition
I want to fill NULL values in device column for each session_id with an associated non-NULL value. How can I achieve that? Here is the sample data: +————+——-+———+ | session_id | step …
Using columns in window function that are not in Group By, I get : SQL compilation error: [COLUMN_A] is not a valid group by expression
I’ve seen a lot of questions about this error, the closest one (as it’s using window function) to my issue would be this one My issue is that I use columns in the windows function that are not …
Generating a View From Dynamic Query Bigquery
We are generating a dynamic query using the script below : We want to create a view out of this is there any way in BQ by which we can create a view from this, so as user we can directly query our view. Answer Should be as simple as just adding create or replace view project.dataset.myview as to original
Remove Null from For loop of ArrayList
I am currently converting an ArrayList to a String to send it to a DB so I can retrieve it on the other end and convert it back to an ArrayList later. My thought process is to convert it to a string …
Oracle several counts over partition
I have the below query which is outputting the below results: SELECT a, b, COUNT(1) count, round(RATIO_TO_REPORT(COUNT(1)) OVER() * 100, 2) perc FROM t1 WHERE condition1 GROUP …
Where can i find msi table column properties?
Where can I find the information about the datatypes used in the above create statement? I need info on all the msi tables. Answer MSI SDK: This section in the MSI SDK lists the built-in MSI tables: https://docs.microsoft.com/en-us/windows/win32/msi/database-tables – see the Orca section below for more …
MySQL – Join tables to a custom list/array of values
I would like to know if it’s possible to join tables into a custom set of values in MySQL. For example, I have a set of dates (outside the database). I would like to get the matched joins in a single query so that I can easily loop through the result. Like: Data outside database Date 2021-04-08 2021-04-…