Select the first row with specific column value

i have a table being accessed by multiple threads. The table contains a column with the row status i.e "Dialed" if it had already been processed and "Not Dialled" if it isn't . I would want to

Select first row where status = "not Dialled" (Read Past ).

I am using readpast so that multiple threads can have different rows and no deadlock happens.

Is the use of Read Past ok here and secondly how can I get the first row always

Answers


You can simply use "Top" clause like this.

Select Top 1
    *
    From Data
        Where status = "not Dialled"
        ;

Cheers


The TOP clause is used to specify the number of records to return. Note: Not all database systems support the TOP clause.

SQL Server Syntax: SELECT TOP number|percent column_name(s) FROM table_name

MySQL Syntax: SELECT column_name(s) FROM table_name LIMIT number Example

Oracle Syntax: SELECT column_name(s) FROM table_name WHERE ROWNUM <= number

Further Reference: http://www.w3schools.com/sql/sql_top.asp


Need Your Help

C# immutable int

c# int immutability

In Java strings are immutable. If we have a string and make changes to it, we get new string referenced by the same variable:

C# dual Outlook 2007/2010 VSTO Add-in

c# .net outlook vsto outlook-addin

We need to create a VSTO add-in in C# that supports both Outlook 2007 and 2010.