Skip to content

WHERE returning entire table

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 …

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%’ …