8,242 questions
1
vote
3
answers
76
views
SQL query to aggregate and count non-null values across multiple columns
I have the following database schema. It looks at shoppers and how many orders they have made from three websites in a network.
ID
Name
Country
website1_Orders
website2_Orders
website3_Orders
123
...
-2
votes
1
answer
66
views
DateFromParts and CASE expression causing an error
I am getting the error shown below, when using the provided CASE expression. Every value of Offername in the sample I am currently running fails both of the WHEN conditions and should return a null. ...
1
vote
2
answers
84
views
Create a new column based on values in the same table
This is an idea of how my table looks -
no
country
language
translatedName
1
c1
en
test1EN1
1
c1
l1
testL1
2
c2
en
test1EN2
2
c2
l2
testL2
This is how the data might look like where a country can have ...
0
votes
3
answers
101
views
Case to check if dates are same in a group
I have a Customer table with dataset like below:
CustID
OrderDate
OrderType
Orig_Value
A
1/1/2025
Bulk
10
A
1/2/2025
Individual
20
B
1/3/2025
Bulk
30
B
1/3/2025
Individual
10
C
1/4/2025
Bulk
0
C
1/4/...
-2
votes
1
answer
34
views
10.4.32-MariaDB mysql conditional join horrible performance [closed]
I have a query that uses a conditional join similar to the code snippet below. The join is different depending on whether or not parameter _search_string is null.
Even when _search_string is null, ...
1
vote
2
answers
56
views
How to correct the syntax for ORDER BY that works but the CASE logic is backwards?
I have the following folders table:
+----+--------+------+
| id | folder | user |
+----+--------+------+
| 1 | Inbox | 0 |
+----+--------+------+
| 2 | Drafts | 0 |
+----+--------+------+
| 3 ...
0
votes
1
answer
140
views
Retrieve the value of an input expression from within a case expression in T-SQL
Consider this form of a case expression:
CASE [input_expression]
WHEN [when_expression] THEN [result_expression]
...
ELSE [result_expression]
END
And this example of that form:
CASE db....
-1
votes
2
answers
71
views
Oracle SQL Case statement with a catch-all
I'm trying to write a case statement that will capture various scenarios per usual, but then also capture all previous scenarios in one combined case. Basically a total of all possible scenarios.
I'm ...
0
votes
1
answer
37
views
How can I return values from multiple columns as well as 'Yes' or 'No' to show that another value is or is not present?
I'm trying to pull data relating to a certain type of customer ID. For one of the columns, I need to know only whether there is a value present or not, while still returning all values for the rest of ...
0
votes
0
answers
41
views
Qtest Test Case API - Create Test Case with Parent ID (Submodule)
Can I create a test case using test case API in Qtest based on below POST request:{API_BASE_URL}/projects/{project_id}/test-cases?parentId={new_submodule_id}
If yes then it is not working and not ...
1
vote
1
answer
64
views
SQL Query in Snowflake - Calculate Days of Supply
I tried to find the days of supply each day. For example, date 1/23/2025 - It has inventory 700 which already subtract the forecast, 400 on that day. Count how many date of forecast can be covered by ...
0
votes
1
answer
106
views
Add multiple conditional values to one column [closed]
I'm writing a query designed to check records that exist in 6 different tables for a specific value and, if it's null, indicate that the value is missing (meaning NULL).
However, what I'm struggling ...
1
vote
1
answer
42
views
Separating fields in the same column
I need to separate items in a column to show in the same row but having trouble coming up with the query to get this done
For example, here is how the table shows below currently:
person_id
...
0
votes
2
answers
62
views
Unexpected number of rows returned in case when query
I'm simply trying to profile a table, using a basic case when statement, to count the number of customers who fall into a band, and further split by another column.
My SQL Server query is returning ...
2
votes
1
answer
75
views
How to pass a case of type "function" as a parameter?
I've been using Codable enums to encode my classes to JSON, and I've hit a roadblock:
enum MyEnum: Codable {
case case1(data: Data)
case case2(str: String)
case case3(url: URL)
}
// .....