MIchael, Point well taken.
Cheers,
Adam
On Apr 8, 2004, at 2:47 PM, Michael Stassen wrote:
Good point. I was focused on the question of using the alias to
restrict results, so I left the function in the SELECT part. As you
say, in this query, that would just give a useless column of '1's, so
Good point. I was focused on the question of using the alias to restrict
results, so I left the function in the SELECT part. As you say, in this
query, that would just give a useless column of '1's, so you might as well
leave it out. In that case, though, the alias question is moot. That is,
Mike,
I see what you're saying `active` was the alias name not an actual
column. Ironically I was using a HAVING clause because I agree with
that last post.
Mike, why keep the `IF` statement? You're really saying give me all the
records where this expression is true. Why not just move the expr
Pete Harlan wrote:
On Mon, Apr 05, 2004 at 08:03:33PM -0500, Paul DuBois wrote:
At 17:29 -0700 4/5/04, Daevid Vincent wrote:
I'm curious when will I be able to do something like this:
SELECT *, IF(( (unix_timestamp()-unix_timestamp(last_seen)) < 600),1,0) as
active FROM wifi_table WHERE active
Adam,
That won't work. Daevid doesn't have a column named active. Nor does he
have to do the math twice. As was pointed out earlier, he can do what he
wants using HAVING instead of WHERE, like this:
SELECT *,
IF(((unix_timestamp()-unix_timestamp(last_seen)) < 600),1,0) active
FROM wifi
Daevid,
SELECT *
FROM wifi_table
WHERE active = 1
HAVING unix_timestamp()-unix_timestamp(last_seen) < 600;
Regards,
Adam
On Apr 5, 2004, at 8:29 PM, Daevid Vincent wrote:
I'm curious when will I be able to do something like this:
SELECT *, IF(( (unix_timestamp()-unix_timestamp(last_seen))
On Mon, Apr 05, 2004 at 08:03:33PM -0500, Paul DuBois wrote:
> At 17:29 -0700 4/5/04, Daevid Vincent wrote:
> >I'm curious when will I be able to do something like this:
> >
> >SELECT *, IF(( (unix_timestamp()-unix_timestamp(last_seen)) < 600),1,0) as
> >active FROM wifi_table WHERE active = 1;
>
Hi,
This is what HAVING is for. :-)
Matt
- Original Message -
From: "Joe Rhett"
Sent: Monday, April 05, 2004 8:59 PM
Subject: Re: Why can't I use an "AS" value in the WHERE clause.
> On Mon, Apr 05, 2004 at 08:03:33PM -0500, Paul DuBois wrote:
>
On Mon, Apr 05, 2004 at 08:03:33PM -0500, Paul DuBois wrote:
> At 17:29 -0700 4/5/04, Daevid Vincent wrote:
> >I'm curious when will I be able to do something like this:
> >
> >SELECT *, IF(( (unix_timestamp()-unix_timestamp(last_seen)) < 600),1,0) as
> >active FROM wifi_table WHERE active = 1;
>
At 17:29 -0700 4/5/04, Daevid Vincent wrote:
I'm curious when will I be able to do something like this:
SELECT *, IF(( (unix_timestamp()-unix_timestamp(last_seen)) < 600),1,0) as
active FROM wifi_table WHERE active = 1;
I think you'll never be able to do it.
The stuff after the SELECT is calculat
I'm curious when will I be able to do something like this:
SELECT *, IF(( (unix_timestamp()-unix_timestamp(last_seen)) < 600),1,0) as
active FROM wifi_table WHERE active = 1;
It's so obnoxious, especially since I can do this:
SELECT *, IF(( (unix_timestamp()-unix_timestamp(last_seen)) < 600),1,0
11 matches
Mail list logo