I want a list of motor carriers, with trailer equipment counts listed in separate columns. I am using case statements to categorize the different equipment types, but I’m getting multiple returns …
Remove character from dynamic string
I have a file with some junk values and i need to get rid of them while loading that file into a table. Giving here some example. File is semicolon separated, and last column has those junk values. …
Combining two columns of a table and returning it as a single column separated by a character
I’m using oracle sql developer for the first time. I want to create a view with two columns of a table combined and seperated by a slash. I have done this in ssms but when I write the same code for …
Get counts of rows for each joined table for each row in the main table
I have three tables in my database. The central table in the star schema is sendings with a PK column called id. Each sending record can have zero or more rows in the tables opens. sendings.id = …
select distinct window function in PostgreSQL
I have a data table like the following: How do you select the distinct continuities for each Longitudinal distance in a 10-step rolling window? Ideally, I’d want something in the Ideal output column …
Dividing by decimal values – rounding issue
I’m trying to divide two decimal values, in hope they will return the following; 1.132930. However, SQL appears to be rounding the value to 1.132931. The value returned before conversion is 1.1329305135951. The SQL code i’m using is as follows: Answer You can round the value before the cast as fol…
EXISTS not working with subquery in WITH clause
I ran into a query where the EXISTS clause is not working properly. The query returns results even for items where no matching record exist, seemingly ignoring the EXISTS completely. It used to work …
SQL Combining two different tables
(P.S. I am still learning SQL and you can consider me a newbie) I have 2 sample tables as follows: Table 1 |Profile_ID| |Img_Path| Table 2 |Profile_ID| |UName| |Default_Title| My scenario is,…
Adding percentage to number in SQL
I would like to add a percentage sign after a number in SQL. This is the query I have select cast(vetted as float)/cast(account_create as float)*100 from numbers I have tried using the format …
Filter rows over partitions
Suppose I have the following table: +——-+————+ | nGroup | Status | +——-+————+ | 1 | DONE | | 1 | UNKNOWN | | 1 | DONE | …