I have the following query: SELECT SUM(case when s1 = ‘fel’ then 1 else 0 end) as s1_count, SUM(case when s2 = ‘fel’ then 1 else 0 end) as s2_count, SUM(case when s3 = ‘fel’ then 1 else 0 …
Tag: sql
MySQL selecting entries when true and replace with null when false
I am programming an office schedule. I have a table users in which each user has a regular schedule hreg that is monday to friday. I have a table hleave in which I enter a leave code for the dates …
Two tables, join not returning data from one table
I have two tables, one (Organisations) with 60 rows of data and the other (Question Data) which has hundreds of rows of data. They both have a column OrgID which is a text field of 5 characters length….
Is possible to use an expression logic on @Formula which has a boolean field to compare dates?
I’m trying to know if the following example works with @Formula of hibernate, perhaps someone can help to solve the other ways, to use sql or queries. When I do that example get the following error: 2019-03-03 05:29:57.568 ERROR [service_a,4fedd46e4085e86f,4fedd46e4085e86f,false] 608 — [nio-8090-e…
SQL Query Sum, Multiply and combine 5 tables then group
I’ve created my table. I’m trying to craate a query that multiply and add sold_quantity from sold table and sale_price from on_sale table and called it R1 for now, and retail_price from product table …
sql – Is there a way to filter through the results of a SELECT query, with another SELECT query?
Specifically, what I am trying to do is rank a table by a column value, referred here as power, and then take that ranked table and find a specific row, or a user in this case. Much like what would be …
Get column name of Table based on query
I have this SQL query Query And this is my table let’s say Tree_table So I want my output to be Is this possible using SQL query or even PHP will do Answer You need to unpivot the data. In MySQL, this is probably most easily done with union all:
Oracle not auto-generating primary key on insert
New to Oracle here. I have a table created with the following SQL: create table Widgets ( id integer constraint pkWidgets primary key using index, ruleId integer not …
Finding employees who are not managers
I have a table where we have staff_id and manager_id. Attached screenshot. I found managers by using this query: select e.first_name as employee , m.first_name as manager from sales.staffs E inner …
SQL server: How to Modify a JSON element value in a nested JSON array
If i have below JSON (@CarDataJsontest) e.g { “house”: { “gate”: [ “Car1”, “Car911”, “Car3”, “Car4” ] } } If i need to do is to modify the car911 to car2 all i …