Skip to content

SQL Count depending on certain conditions

I have two tables. One have userid and email (users table). The other have payments information (payments table) from the userid in users. I want to count the PaidMonths taking in consideration the following rules: If ValuePaid < 10 PaidMonths should be = 0.23 (even if in the column the value seen is any o…

LEFT JOIN ON NULL Key Values Combined with GROUP BY

I’m using Teradata SQL and I wrote the following query (pay attention at the LEFT JOIN) Some entries for t1.key2 und t1.key3 (of the left sided table) are NULL. When that’s the case, the rows are not showing in the result, why? Is that Teradata specific, I would expect a LEFT JOIN to show rows wit…

Having and Where in combination with Group By

I have learned to use HAVING when I use GROUP BY instead of the WHERE clause and never encountered any problems with it. Today I saw this on a w3schools.com a SQL Learning Page: Why this should work? When I should use this? Answer The difference between WHERE and HAVING is central to when you should employ on…

How do you prevent tags from displaying in textarea?

I am saving this string into my sql db: This displays fine in a table: But when I display it in a textarea it shows up like this: How can I get the textarea to keep the formatting but not show the <br> tags. Answer You would want to strip out the <br> tags and the extra space. Here’s a

remove extra “WWW_” using sql SUBSTRING [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 11 months ago. Improve this question In the Name_code column, we have these types of I want O/P the value like this SUBSTR(Name…

LIKE group_concat with where clause

i am using Like in group concat & i want to get all modules attached to client even if it does not match to LIKE, i know that that i can do that with HAVING but i don’t want to use HAVING, any solution with WHERE or in join condition ? Any suggestions on how to get my expected result??