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

    Sep 15, 2008 · 116 You can find some nice examples in The Power of SQL CASE Statements, and I think the statement that you can use will be something like this (from 4guysfromrolla):

  2. SQL WITH clause example - Stack Overflow

    Sep 23, 2012 · 353 The SQL WITH clause was introduced by Oracle in the Oracle 9i release 2 database. The SQL WITH clause allows you to give a sub-query block a name (a process also …

  3. sql - NOT IN vs NOT EXISTS - Stack Overflow

    Which of these queries is the faster? NOT EXISTS: SELECT ProductID, ProductName FROM Northwind..Products p WHERE NOT EXISTS ( SELECT 1 FROM Northwind..[Order Details] …

  4. CASE .. WHEN expression in Oracle SQL - Stack Overflow

    CASE .. WHEN expression in Oracle SQL Asked 13 years, 2 months ago Modified 4 years, 10 months ago Viewed 968k times

  5. sql - What is SELF JOIN and when would you use it? - Stack Overflow

    Jun 13, 2024 · You use a self join when a table references data in itself. E.g., an Employee table may have a SupervisorID column that points to the employee that is the boss of the current …

  6. Convert Rows to columns using 'Pivot' in SQL Server

    Apr 10, 2013 · If you are using SQL Server 2005+, then you can use the PIVOT function to transform the data from rows into columns. It sounds like you will need to use dynamic sql if …

  7. SQL Case Expression Syntax? - Stack Overflow

    Aug 7, 2008 · Search conditions are detailed in the Transact-SQL User’s Guide. then precedes the expression that specifies a result value of case. expression is a column name, a constant, …

  8. SQL: IF clause within WHERE clause - Stack Overflow

    Sep 18, 2008 · Is it possible to use an IF clause within a WHERE clause in MS SQL? Example: WHERE IF IsNumeric(@OrderNumber) = 1 OrderNumber = @OrderNumber ELSE …

  9. Best way to do nested case statement logic in SQL Server

    I'm writing an SQL Query, where a few of the columns returned need to be calculated depending on quite a lot of conditions. I'm currently using nested case statements, but its getting messy. …

  10. Using RegEx in SQL Server - Stack Overflow

    Jan 19, 2012 · On-prem Microsoft SQL Server will gain the same regex feature in the next major release ("vNext" as they say; so, that'll be SQL Server 2025 presumably). The new set of …