"Sue Cram" <[EMAIL PROTECTED]> wrote on 02/08/2005 01:18:48 AM:
> Thanks to the people who helped me with my IF statement question
> last night. Now I need to carry it one step further to a compound
> 'IF' statement. Again, can't find much information in the manuals --
>
> Several people sent
Harald Fuchs wrote:
That's correct, but it can be written shorter and clearer:
CASE Lccation
WHEN 1 THEN 'Downstairs Cat Room'
WHEN 2 THEN 'Kitten Room'
WHEN 3 THEN 'Quarantine'
ELSE 'Unknown' END AS Location
- surely it would be better to have the location ids and location names
in a lookup ta
In article <[EMAIL PROTECTED]>,
Johan Höök <[EMAIL PROTECTED]> writes:
> Hi,
> I guess your "CASE" statement should look something like:
> CASE WHEN Location=1 THEN 'Downstairs Cat Room'
> WHEN Location=2 THEN 'Kitten Room'
> WHEN Location=3 THEN 'Quarantine'
> ELSE 'Unknown' EN
I didn't found an IF ... ELSE ... in MySQL ... and I'm using it for at
least 4 years !... since the old 3.23.xx times !!!
So you will have to do:
SELECT a,b,c,
IF(Location=1, 'Downstairs Cat Room',
IF(Location=2, 'Kitten Room',
Hi,
I guess your "CASE" statement should look something like:
CASE WHEN Location=1 THEN 'Downstairs Cat Room'
WHEN Location=2 THEN 'Kitten Room'
WHEN Location=3 THEN 'Quarantine'
ELSE 'Unknown' END AS Location
/Johan
Sue Cram wrote:
Thanks to the people who helped me with my IF state
I did a lot of homework on IF statements recently.
Below are copies of some of the scripts I'm using now.
This first example draws on a database filled with the
names of the world's continents, oceans, nations and
states, each given an ID in a field named IDArea. Each
page on my site h
Thanks to the people who helped me with my IF statement question last night.
Now I need to carry it one step further to a compound 'IF' statement. Again,
can't find much information in the manuals --
Several people sent me "IF (Adopted=1, 'Y', 'N') AS Adopted FROM Animal" and it
works great.
[snip]
That's up to you of course. Personally, I think some things are better
handled by the database and some are better handled by the programming
language. Things like conditional logic tend to be best handled by the
programming language in my view. Your mileage may vary ;-)
[/snip]
AT the risk
e pictures and music programs to create music.
Rhino
- Original Message -
From: "Luke Venediger" <[EMAIL PROTECTED]>
To: "Rhino" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, October 27, 2004 5:47 PM
Subject: Re: Select with an IF statem
]> wrote:
>
> - Original Message -
> From: "Luke Venediger" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, October 27, 2004 4:58 PM
> Subject: Select with an IF statements
>
> > Hi,
> >
> > I'm t
Thanks Paul!
Luke Venediger.
On Wed, 27 Oct 2004 16:17:51 -0500, Paul DuBois <[EMAIL PROTECTED]> wrote:
> At 22:58 +0200 10/27/04, Luke Venediger wrote:
> >Hi,
> >
> >I'm trying to do the following:
> >
> >SELECT
> > IF((ProductStatus IS NOT NULL), "Available", "Not Available") as
> >ProductSt
- Original Message -
From: "Luke Venediger" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, October 27, 2004 4:58 PM
Subject: Select with an IF statements
> Hi,
>
> I'm trying to do the following:
>
> SELECT
> IF((ProductSta
At 22:58 +0200 10/27/04, Luke Venediger wrote:
Hi,
I'm trying to do the following:
SELECT
IF((ProductStatus IS NOT NULL), "Available", "Not Available") as
ProductStatus
FROM
tb_Product
WHERE
ProductName = "MyProduct";
It works fine if the ProductName "MyProduct" works, and returns
"Availabl
Hi,
I'm trying to do the following:
SELECT
IF((ProductStatus IS NOT NULL), "Available", "Not Available") as ProductStatus
FROM
tb_Product
WHERE
ProductName = "MyProduct";
It works fine if the ProductName "MyProduct" works, and returns
"Available". However, if the product name doesn't work
That did the trickthanks so much!
Cory
On Wed, 2004-01-14 at 12:50, Douglas Sims wrote:
> Would something like this do what you want?
>
> SELECT project_id, SUM(time_worked) AS total FROM time_daily WHERE
> user_id='clh' AND period_id='27' GROUP BY project_id HAVING total>0;
>
>
>
> Cor
Like this:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.13
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
umysql> use test;
Reading table information for completion of table and column names
You can turn off this fea
Would something like this do what you want?
SELECT project_id, SUM(time_worked) AS total FROM time_daily WHERE
user_id='clh' AND period_id='27' GROUP BY project_id HAVING total>0;
Cory Hicks wrote:
Hello,
I must be having a goober moment.I am running the following sql
query with no probl
From: Cory Hicks [mailto:[EMAIL PROTECTED]
> Hello,
>
> I must be having a goober moment.I am running the following sql
> query with no problems:
>
> SELECT project_id,
> IF (SUM( time_worked ) > '0.00', SUM( time_worked ),'NULL') AS total
> FROM time_daily
> WHERE user_id = 'clh' AND period
Hello,
I must be having a goober moment.I am running the following sql
query with no problems:
SELECT project_id,
IF (SUM( time_worked ) > '0.00', SUM( time_worked ),'NULL') AS total
FROM time_daily
WHERE user_id = 'clh' AND period_id = '27'
GROUP BY project_id
However, having 'NULL' appear
I'm performing a query on 2 tables:
mysql> SELECT log.id, SUM (log.hours), empnum.lname
> FROM log, empnum
> WHERE log.id = '26009'
> AND log.id=empnum.id
> GROUP BY hours;
Empty set (0.01 sec)
The log table contains id numbers (plus a bunch of other data) but no
corresponding names. The name
Does anyone know why this isn't working?? What I am trying to do is display
photos from a database based on each month. This part works fine when I set
it to the current month of December (today) as that is when I uploaded the
photos.
However, when I manually set the date to a month that has n
Hi.
On Tue, Aug 14, 2001 at 01:31:04PM -0700, [EMAIL PROTECTED] wrote:
> I am trying to do a nested if, but it appears to break my query...
> Here is a sample of what I am trying to, basically validating email
> addresses out of a db:
>
> select IF( (LENGTH( emailaddr ) <= 1 ||
> NOT LOCATE( "
I am trying to do a nested if, but it appears to break my query...
Here is a sample of what I am trying to, basically validating email
addresses out of a db:
select IF( (LENGTH( emailaddr ) <= 1 ||
NOT LOCATE( "\@",emailaddr ) ||
LOCATE( " ",emailaddr ),
(IF address.ts >= 2001081300,
23 matches
Mail list logo