Re: How to find first not null value in column



On 28 Jan 2006 11:51:33 -0800, --CELKO-- wrote:

>>> How to find first not null value in column without chacking whole table <<
(snip)
>Let's make a guess, based on nothing you posted, as to what the DDL
>looks like:
>
>CREATE TABLE Foobar
>(foo_key INTEGER NOT NULL PRIMARY KEY, -- order by him??
> klugger INTEGER, -- target column ??
> ..);
>
>SELECT foo_key
> FROM Foobar
> WHERE klugger IS NULL
> AND foo_key
> = (SELECT MIN(foo_key) FROM Foobar);

HHi Joe,

I do hope that you actually intended to post

SELECT MIN(foo_key)
FROM Foobar
WHERE klugger IS NULL

--
Hugo Kornelis, SQL Server MVP
.



Relevant Pages