Question: How do I ignore WHERE param if value = ‘0’ or NULL One of the columns returned is showing 0 which is causing problems in my query. The problem I am having is in the p.author value. …
Generate query using 5 tables
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 …
Summing the total of 4 alias
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 …
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 …
SQL Grouping within Sub Queries
I am trying to group multiple columns based on a case statement. My current code is as follows : SELECT p.SCODE AS PropNumber, p.SADDR1 AS propname, (CASE WHEN ut.scode LIKE ‘%m%’ …
How can I use a SQL query result as a column in another query?
I got a view that returns weekday. The result will be a column in WHERE clause, something like this: SELECT * FROM dvtv_delivery WHERE (SELECT day FROM dvtv_weekday) = ‘Y’ For example: Today is …
how to select max of two columns and group it by station
I have a simple table like this station num tim 1 150 10 1 200 222 1 100 5000 1 200 555 2 100 500 2 120 200 3 …
How to INNER JOIN the correct VALUE from 2 values in the table where 1 is correct
I need to select and inner join the correct u1 or u2 the opposite of the current user to display the correct friend’s list with the correct picture/id Sess id $sess_id = $_SESSION[‘user’][‘id’]; …
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…