I have TWO simple VIEWS with columns PID and NAME respectively. Here’s how they are connected to each other. View1: PID NAME Comp1 , C1 Comp2 , C2 View2: PID NAME ParentPID …
Tag: sql
Getting count depending on subquery
In my SELECT statement below, I’m looking to get a COUNT of connections from a table, where connections are defined as 1 connection per unique transactionID. Thus, in my COUNT, I want to check to make …
SQL Query to Select Min and Max Values For Each Day Over a Period
I would like to select all the rows that contain either min or max datetime values for each equipment_id, for every day included in the period. The code below selects the min and max datetime values …
Is it possible to select a distinct column and get another column’s value count? [closed]
I think I might know enough to do parts individually but is it possible to do it with one statement? I need to display a model count for each year it appears in. I have the following data: id model …
oracle: remove only blank lines
How to remove empty lines in sql or plsql Input select ‘test1 test2 test3 test4’ from dual; Expected output: test1 test2 test3 test4 TRANSLATE is removing all the new line character
What is the simplest way to put pass an array of values into a parameter of TVF
Objective: I would like to have a parameter in my function to allow the user to input a list of values. Ideally, the simplest solution … Note: I dont have permissions to create tables in dbs. …
Using CASE WHEN to assign buckets
Fairly new to coding. I’ve created a new column that outputs the days a task is overdue using DateDiff. I then want to take the result of the DateDiff and assign it an expression (>60 days overdue, 30-…
SQL Finding result in one table based on a second table
I have two tables and I need to find all invoice that have a ready day of today and have no period in the INumber and all items have not been delivered. Each Invoice may have several rows in …
Need to join but on a secondary table
I have this one view all_people_expanded_view that has all the data needed except 1. The race of client is in race table. But the description is in race_info. I need to join on race on people_id, but …
How to insert new rows based on values in other columns in sql server?
I have a dataset like below: Id A14_Comment A15_Comment A16_Comment 1 Comment1 null null 2 Comment2 Comment3 Comment4 3 null Comment5 …