About 2,140,000 results
Open links in new tab
  1. How do I perform an IF...THEN in an SQL SELECT?

    Sep 15, 2008 · The CASE statement is the closest to IF in SQL and is supported on all versions of SQL Server. SELECT CAST( CASE WHEN Obsolete = 'N' or InStock = 'Y' THEN 1 ELSE 0 …

  2. How to Use If Else in SQL Select Statement - GeeksforGeeks

    Jan 2, 2025 · By using IF...ELSE within SQL statements we can categorize data, apply conditional transformations, and implement business logic directly in our queries. In this article, We will …

  3. How to Execute an IF…THEN Logic in an SQL SELECT Statement

    May 28, 2024 · In this article, we explored different options for executing IF-THEN logic in a SQL SELECT statement. These options include using CASE, IIF(), and CHOOSE(). Furthermore, if …

  4. How the Hell I use SQL IF Statement in SELECT [5 Methods]

    Jan 21, 2023 · In this tutorial, we will explore the magic of using SQL if statement in SELECT within your database queries. This technique is like a superpower that allows us to adjust and …

  5. MySQL IF() Function - W3Schools

    The IF () function returns a value if a condition is TRUE, or another value if a condition is FALSE. Required. The value to test. Required. The value to return if condition is TRUE. Required. The …

  6. SQL IF Statement for Conditional Logic - SQL Server Tips

    Sep 12, 2022 · I’m learning T-SQL and need to know how to use an IF statement to include conditional statements within a stored procedure, function, trigger, or script in Microsoft SQL …

  7. IF Statement in SQL Queries Explained with Examples

    Mar 1, 2024 · In SQL, the IF statement facilitates conditional execution, enhancing the ability to tailor queries based on specific criteria. This tutorial delves into the syntax, examples, and …

  8. How to use 'IF' in 'SELECT' SQL statements? - DevDojo

    Mar 7, 2022 · In this article, we will explain how to use the CASE expression in SELECT SQL statements. We will also explain how to use an alternative approach with an IF clause for …

  9. IF...ELSE (Transact-SQL) - SQL Server | Microsoft Learn

    Imposes conditions on the execution of a Transact-SQL statement. The Transact-SQL statement that follows an IF keyword and its condition is executed if the condition is satisfied: the …

  10. Using If else in SQL Select statement - Stack Overflow

    Dec 8, 2014 · You can use simply if statement under select query as like I have described below . if(some_condition,if_satisfied,not_satisfied) SELECT IF(IDParent < 1,ID,IDParent) FROM …

  11. Some results have been removed
Refresh