Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
75 views

I have the following SQL to create a materialized view and the SQL seems reasonable to me but it's unclear from Postgres docs what should happen in this case. I am listing the columns when creating ...
Byofuel's user avatar
  • 448
-1 votes
1 answer
54 views

I have a view which extracts data from two other views, joining on ID and date columns. WITH CTE A AS ( SELECT * FROM TABLE A -- A UNION OF SEVERAL TABLES ), CTE B AS (SELECT * FROM TABLE B WHERE ...
David Skaife's user avatar
1 vote
1 answer
156 views

I am using SQL Server 2017 and I am writing an UPDATE statement with a CASE expression. In the update statement I am having an issue with the calculation. It is a simple calculation when I cast the ...
zwheeler's user avatar
4 votes
1 answer
114 views

From a 6-character string in TERM_CODE_KEY I need to produce a calculated result as column academic_yr: -- TERM_CODE_KEY is of type VARCHAR2(6) and returns values of the form YYYYMM SELECT ...
Ross's user avatar
  • 81
-1 votes
2 answers
79 views

I have 2 tables: DEPT: dept_no C N 1 200 100 2 300 150 3 400 200 and EMP: dept_no employee_no Task_status Salary 1 1 C 1 2 N 2 1 C 2 2 C with column Salary has to be calculated. Task status is C is ...
Sfdclearner's user avatar
1 vote
1 answer
121 views

I need group speed by ram and return MAX(speed), where at least one NULL in speed values will return NULL. ram speed 128 600 128 600 128 750 128 750 128 800 128 900 32 400 32 NULL 32 500 64 450 64 500 ...
Igor's user avatar
  • 49
0 votes
1 answer
91 views

I am trying to use the SQL commands COUNT and GROUP BY to show the number of students with each letter grade, but I'm having difficulty in doing so. A new column that I created contains a letter grade ...
Colton's user avatar
  • 1
-1 votes
1 answer
114 views

Consider this SELECT CASE WHEN 1=1 THEN 1 WHEN 1=1 THEN 1/0 END This returns 1. A clear example of how the WHENs are evaluated in order. However, when I do this: DECLARE @...
gebruiker's user avatar
  • 125
1 vote
3 answers
103 views

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 ...
DJR's user avatar
  • 11
1 vote
2 answers
100 views

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 ...
Avani Agrawal Nath's user avatar
-2 votes
1 answer
59 views

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, ...
Jon Vote's user avatar
  • 691
0 votes
1 answer
161 views

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....
Mike's user avatar
  • 320
0 votes
1 answer
67 views

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 ...
SQL Noob's user avatar
1 vote
1 answer
76 views

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 ...
Yu Ching Tsoi's user avatar
1 vote
1 answer
50 views

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 ...
agloria's user avatar
  • 13
2 votes
1 answer
92 views

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) } // .....
benhatsor's user avatar
  • 2,053
-2 votes
1 answer
74 views

I am working on restaurant project. The restaurant takes online orders and "in restaurant" orders I need to print out all active orders with 1 query. The problem comes when I need to ...
Europeuser's user avatar
1 vote
3 answers
84 views

I'm using SQL and I have some dummy car dealership data that for a given dealership tells me whether a particular make is currently being sold there, and if not, when the last time that make was ...
dom_2108's user avatar
1 vote
1 answer
103 views

I am trying to query the correct price by going through and choosing between 2 prices. These are in order of importance from highest to lowest: if [tran_type] is equal to Quot than choose this price ...
Siege's user avatar
  • 19
0 votes
2 answers
66 views

I'm working on my first SQL case statement - and unsure how to do this. I have two different columns of data, one is for drive A, the other drive B. I want to select data from drive A for display ...
Chris Brunner's user avatar
-3 votes
4 answers
129 views

This is what I have so far: DECLARE @STR AS VARCHAR(1000) = 'CustomerID #101010 added. Fixed Price: 3.5555 Effective from 10/16/2024 to 03/31/2 SADFGZFGDA025 Deliveries: 100 Company Pricing Program: ...
SQL_Aliases's user avatar
2 votes
2 answers
224 views

Is this a bug, non-conformant behavior, or standardized behavior? A Polars SQL statement is calculating the average of values based on a condition. The CASE WHEN doesn't include an ELSE because those ...
BSalita's user avatar
  • 9,071
2 votes
2 answers
94 views

I am learning VBA and attempting to automate a report that has multiple steps. Step 1 - Click Button #1 to run a macro with a series of formulas based on input data provided by the user. Step 2 - ...
Jamie901's user avatar
1 vote
1 answer
475 views

In System Verilog, I want to instruct the synthesizer to infer a parallel check of some conditions, thus I am using a unique case. I am also adding a default statement. What I would expect is the ...
Matteo5v5's user avatar
-1 votes
1 answer
75 views

I have two tables I am trying to write a GROUP BY clause with multiple CASE statements so that the data will be grouped into one row for each client instead of multiple rows for each client. Here is a ...
tnlewis's user avatar
  • 323

1
2 3 4 5
195