Garayed.com  

Go Back   Garayed.com > mySQL
FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-21-2007, 02:47 PM
Rik
 
Posts: n/a
Default Re: Use of IFNULL in SELECT query with subqueries

On Sat, 21 Jul 2007 16:20:01 +0200, P.A. <anschouwe@yahoo.com> wrote:
> mysql> SELECT IFNULL(min(a.lowestnum) AS num_new FROM (SELECT id_staff+1
> AS lowestnum FROM staff_data) a WHERE a.lowestnum NOT IN (SELECT
> id_staff FROM staff_data), '1');
> ...which does not work :-(



SELECT IFNULL(min(a.lowestnum),1) AS num_new FROM (SELECT id_staff+1
AS lowestnum FROM staff_data) a WHERE a.lowestnum NOT IN (SELECT id_staff
FROM staff_data);
--
Rik Wasmus
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 07-22-2007, 10:54 AM
P.A.
 
Posts: n/a
Default Re: Use of IFNULL in SELECT query with subqueries

Am 21.07.2007, 16:47 Uhr, schrieb Rik <luiheidsgoeroe@hotmail.com>:

> SELECT IFNULL(min(a.lowestnum),1) AS num_new FROM (SELECT id_staff+1
> AS lowestnum FROM staff_data) a WHERE a.lowestnum NOT IN (SELECT
> id_staff FROM staff_data);


Yep, that works! Thought I tried that before but probably missed something.

Thanks!

Pascal.


--
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 02:15 AM.




LinkBacks Enabled by vBSEO 3.0.0 © 2007, Crawlability, Inc.