I’m building a blog and have two tables articles and categories and I’m joining these tables, but what I want to do is display just the categories if I click a categories link. I’m passing the …
Tag: if-statement
PostgreSQL IF statement
How can I do such query in Postgres? IF (select count(*) from orders) > 0 THEN DELETE from orders ELSE INSERT INTO orders values (1,2,3);
How do I perform an IF…THEN in an SQL SELECT?
How do I perform an IF…THEN in an SQL SELECT statement? For example: Answer The CASE statement is the closest to IF in SQL and is supported on all versions of SQL Server. You only need to use the CAST operator if you want the result as a Boolean value. If you are happy with an int, this works: CASE