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

    Sep 15, 2008 · SELECT CASE WHEN Obsolete = 'N' or InStock = 'Y' THEN 1 ELSE 0 END as Saleable, * FROM Product CASE statements can be embedded in other CASE statements …

  2. SQL - Select first 10 rows only? - Stack Overflow

    Dec 12, 2009 · How do I select only the first 10 results of a query? I would like to display only the first 10 results from the following query: SELECT a.names, COUNT(b.post_title) AS num FROM

  3. SQL "select where not in subquery" returns no results

    Sep 10, 2009 · The long answer (From T-SQL Fundamentals, Third edition, by Itzik Ben-Gan) This is an example: Imagine there is a order with a NULL orderid inside Sales.Orders table, so …

  4. sql server - SQL select from a select query - Stack Overflow

    I want to do a select request that perform a first select and then use that selection to perform a second select. I made a 1st version using a temp table but I would like to know - is there is a wa...

  5. SQL Server SELECT into existing table - Stack Overflow

    I am trying to select some fields from one table and insert them into an existing table from a stored procedure. Here is what I am trying: SELECT col1, col2 INTO dbo.TableTwo FROM …

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

    Nov 23, 2012 · I have a select statement which will return 2 columns. ID | IDParent Then in my program I have to test if IDParent is < 1 then use ID ELSE use IDParent Is there a way to …

  7. How to randomly select rows in SQL? - Stack Overflow

    Feb 24, 2009 · SELECT TOP 1 Column_Name FROM dbo.Table TABLESAMPLE(1 PERCENT); TABLESAMPLE(n ROWS) or TABLESAMPLE(n PERCENT) is random but need to add the …

  8. SQL - Select only 'Year' from DateTime field - Stack Overflow

    Oct 3, 2015 · Your datetime field apparently is not a datetime field but a character field. That means to things. First of all, you shouldn't store date times as text, but rather in the specific …

  9. sql - MySQL SELECT only not null values - Stack Overflow

    Is it possible to do a select statement that takes only NOT NULL values? Right now I am using this: SELECT * FROM table And then I have to filter out the null values with a php loop. Is …

  10. What does SQL Select symbol || mean? - Stack Overflow

    Apr 29, 2014 · Microsoft SQL Server is one of the exceptions: it doesn't support ||, and requires +.