RE: Out of memory, but plenty of swap space left

2005-04-08 Thread Jon Wagoner
Heikki, 

Yes, I'm running MySQL on 32-bit Linux.

I think maybe something had just gotten corrupted.  MySQL restarted
itself yesterday, with the following in the error log:

050407 16:24:49 [ERROR] Out of memory; check if mysqld or some other
process uses all available memory; if not, you may have to use 'ulimit'
to allow mysqld to use more memory or you can add more swap space
mysqld got signal 11;
This could be because you hit a bug. It is also possible that this
binary
or one of the libraries it was linked against is corrupt, improperly
built,
or misconfigured. This error can also be caused by malfunctioning
hardware.
We will try our best to scrape up some info that will hopefully help
diagnose
the problem, but since we have already crashed, something is definitely
wrong
and this may fail.

key_buffer_size=536870912
read_buffer_size=2093056
max_used_connections=201
max_connections=200
threads_connected=49
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections
= 1342686 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd=0x59d064a0
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
frame pointer (ebp) is NULL, did you compile with
-fomit-frame-pointer? Aborting backtrace!
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd-query at 0x59f907f8  is invalid pointer
thd-thread_id=68571
The manual page at http://www.mysql.com/doc/en/Crashing.html contains
information that should help you find out what is causing the crash.
050407 16:24:51  InnoDB: Database was not shut down normally!

 

Unless you tell me different, I'll just plan on upgrading to 4.1.11 (I'm
still running 4.1.8) 

-Original Message-
From: Heikki Tuuri [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 08, 2005 12:24 AM
To: mysql@lists.mysql.com
Subject: Re: Out of memory, but plenty of swap space left

John,

are you running on a 32-bit computer? Then, normally, the process size
is 
limited to 2 GB.

Best regards,

Heikki Tuuri
Innobase Oy
Foreign keys, transactions, and row level locking for MySQL
InnoDB Hot Backup - a hot backup tool for InnoDB which also backs up
MyISAM 
tables
http://www.innodb.com/order.php


- Original Message - 
From: Jon Wagoner [EMAIL PROTECTED]
Newsgroups: mailing.database.myodbc
Sent: Thursday, April 07, 2005 7:31 PM
Subject: Out of memory, but plenty of swap space left


 Recently I've been getting error 1041 at times, which gives the
message
 to update the ulimit or add swap space. =20

 This is a dedicated MySQL server, so I have no ulimit set for MySQL.
 According to /proc/meminfo I have over 1GB of swap free.
 Mem:  2118533120 2067628032 509050880 19677184 1659768832
 Swap: 1998733312 686882816 1311850496
 MemTotal:  2068880 kB
 MemFree: 49712 kB
 MemShared:   0 kB
 Buffers: 19216 kB
 Cached:1320684 kB
 SwapCached: 300184 kB
 Active: 943996 kB
 Inactive:  1008424 kB
 HighTotal: 1179484 kB
 HighFree: 2044 kB
 LowTotal:   889396 kB
 LowFree: 47668 kB
 SwapTotal: 1951888 kB
 SwapFree:  1281104 kB

 The mysqld section of my.cnf contains the following:

 log-bin
 server-id  =3D 106
 basedir =3D /usr
 datadir =3D /var/lib/mysql
 tmpdir  =3D /tmp
 language=3D /usr/share/mysql/english
 skip-locking
 set-variable=3D key_buffer=3D512M
 set-variable=3D max_allowed_packet=3D1G
 set-variable=3D table_cache=3D3072
 set-variable=3D sort_buffer=3D2M
 set-variable=3D record_buffer=3D2M
 set-variable=3D thread_cache=3D8
 set-variable=3D thread_concurrency=3D8
 set-variable=3D myisam_sort_buffer_size=3D64M
 set-variable=3D thread_stack=3D128K
 set-variable=3D open_files_limit=3D8192
 set-variable=3D tmp_table_size=3D50M
 max_tmp_tables =3D 100
 innodb_data_home_dir =3D /var/lib/mysql/
 innodb_data_file_path =3D ibdata1:10M:autoextend
 innodb_log_group_home_dir =3D /var/lib/mysql/
 innodb_log_arch_dir =3D /var/lib/mysql/
 set-variable =3D innodb_buffer_pool_size=3D384M
 set-variable =3D innodb_additional_mem_pool_size=3D20M
 set-variable =3D innodb_log_file_size=3D5M
 set-variable =3D innodb_log_buffer_size=3D8M
 innodb_flush_log_at_trx_commit=3D1
 set-variable =3D innodb_lock_wait_timeout=3D50

 long_query_time=3D30
 query_cache_limit=3D1M
 query_cache_size=3D64M
 query_cache_type=3D1
 max_connections=3D200

 Does anyone have any suggestions as to why I'm getting out of memory
 errors?  Do I have some of the settings wrong?
 If it matters, I have about 50GB worth of data, split between InnoDB
and
 MyISAM tables.  I last got the error updating records in one of the
 MyISAM tables which was about 1MB in size.

 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe

Out of memory, but plenty of swap space left

2005-04-07 Thread Jon Wagoner
Recently I've been getting error 1041 at times, which gives the message
to update the ulimit or add swap space.  

This is a dedicated MySQL server, so I have no ulimit set for MySQL.
According to /proc/meminfo I have over 1GB of swap free.
Mem:  2118533120 2067628032 509050880 19677184 1659768832
Swap: 1998733312 686882816 1311850496
MemTotal:  2068880 kB
MemFree: 49712 kB
MemShared:   0 kB
Buffers: 19216 kB
Cached:1320684 kB
SwapCached: 300184 kB
Active: 943996 kB
Inactive:  1008424 kB
HighTotal: 1179484 kB
HighFree: 2044 kB
LowTotal:   889396 kB
LowFree: 47668 kB
SwapTotal: 1951888 kB
SwapFree:  1281104 kB

The mysqld section of my.cnf contains the following:

log-bin
server-id  = 106
basedir = /usr
datadir = /var/lib/mysql
tmpdir  = /tmp
language= /usr/share/mysql/english
skip-locking
set-variable= key_buffer=512M
set-variable= max_allowed_packet=1G
set-variable= table_cache=3072
set-variable= sort_buffer=2M
set-variable= record_buffer=2M
set-variable= thread_cache=8
set-variable= thread_concurrency=8
set-variable= myisam_sort_buffer_size=64M
set-variable= thread_stack=128K
set-variable= open_files_limit=8192
set-variable= tmp_table_size=50M
max_tmp_tables = 100
innodb_data_home_dir = /var/lib/mysql/
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /var/lib/mysql/
innodb_log_arch_dir = /var/lib/mysql/
set-variable = innodb_buffer_pool_size=384M
set-variable = innodb_additional_mem_pool_size=20M
set-variable = innodb_log_file_size=5M
set-variable = innodb_log_buffer_size=8M
innodb_flush_log_at_trx_commit=1
set-variable = innodb_lock_wait_timeout=50

long_query_time=30
query_cache_limit=1M
query_cache_size=64M
query_cache_type=1
max_connections=200

Does anyone have any suggestions as to why I'm getting out of memory
errors?  Do I have some of the settings wrong?
If it matters, I have about 50GB worth of data, split between InnoDB and
MyISAM tables.  I last got the error updating records in one of the
MyISAM tables which was about 1MB in size.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: Query question

2005-04-07 Thread Jon Wagoner
SELECT product_lines.* FROM product_lines LEFT JOIN
manufacturer_product_line_index ON
manufacturer_product_line_index.product_line_id = product_lines.id WHERE
product_lines.id IS NULL

-Original Message-
From: Ed Lazor [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 07, 2005 11:39 AM
To: mysql@lists.mysql.com
Subject: Query question

Three tables like this:

--
product_lines
--
id
title

--
manufacturer
--
id
title

--
manufacturer_product_line_index
--
id
product_line_id
manufacturer_id


The index provides a one to many relationship - one product line can be
associated with more than one company.

How do I get a list of product lines not in the index?

Thanks,

Ed


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: start warning

2003-11-25 Thread Jon Wagoner
Assuming he is using the mysql init script from Gentoo, he just needs to run
/sbin/depscan.sh

-Original Message-
From: Bob Lockie [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 25, 2003 2:50 PM
To: MySQL Mailing List
Subject: start warning



I am posting this on behalf of a Gentoo user.
Does anyone know why this warning happens?

# /etc/init.d/mysql start
* Could not get dependency info for mysql!
* Could not get dependency info for mysql!
* Starting mysqld...

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Wrong bytesec: 0-0-0 at linkstart: 292251752

2003-11-19 Thread Jon Wagoner
I have gotten several of these errors over the last couple of months.  This
has happened on two different servers.  (Both are running MySQL 4.0.16 on
Red Hat 7.3)

It mainly happens in one particular table, but has happened in another one.
I have tried dropping and recreating the table, but that doesn't seem to
help.  This table has about 75,000 - 100,000 records inserted per day.  They
are never deleted, but I daily delete records older than 2 weeks.

Someone has suggested that it might be bad memory, but since it happens on
both servers, and on the same table in each case, it seems like there is
something more.

Jon


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



periodic corruption problem

2003-11-10 Thread Jon Wagoner
I am running MySQL 4.0.16 on a Red Hat 7.3 server.  I am having problems
with tables periodically getting corrupted.  The one it happens most often
on is a table I use for logging various status messages.  This table
receives mostly inserts, and very few selects.  It is about 400MB in size,
with about 1.3M rows.  I just had it happen to another table, that receives
mostly selects, and few inserts or updates.  It is only about 60MB in size,
with about 95k rows.  Both of these tables rarely have deletes.

The last time, I believe the error message said something about the index
being the wrong size.  Sorry I didn't write it down, but I was in a hurry to
get things working again.  Can anyone provide some help on this problem?


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: periodic corruption problem

2003-11-10 Thread Jon Wagoner
It's been going on for months, so that doesn't seem very likely.  On the
other hand, we have had 2 or 3 other hard drives go bad with other servers
at this host, so I'm not ruling it out.

-Original Message-
From: Big Brother [mailto:[EMAIL PROTECTED]
Sent: Monday, November 10, 2003 12:04 PM
To: Jon Wagoner
Cc: [EMAIL PROTECTED]
Subject: Re: periodic corruption problem


my experience with corrupted tables is usually followed by a failed
harddrive
aka the disk may be diing ...

--



Quoting Jon Wagoner [EMAIL PROTECTED]:

 I am running MySQL 4.0.16 on a Red Hat 7.3 server.  I am having problems
 with tables periodically getting corrupted.  The one it happens most often
 on is a table I use for logging various status messages.  This table
 receives mostly inserts, and very few selects.  It is about 400MB in size,
 with about 1.3M rows.  I just had it happen to another table, that
receives
 mostly selects, and few inserts or updates.  It is only about 60MB in
size,
 with about 95k rows.  Both of these tables rarely have deletes.

 The last time, I believe the error message said something about the index
 being the wrong size.  Sorry I didn't write it down, but I was in a hurry
to
 get things working again.  Can anyone provide some help on this problem?


 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: periodic corruption problem

2003-11-10 Thread Jon Wagoner
I will switch to the secondary server tonight and see if the problems clear
up.  Thanks for the response.

-Original Message-
From: John Griffin [mailto:[EMAIL PROTECTED]
Sent: Monday, November 10, 2003 1:49 PM
To: Jon Wagoner; [EMAIL PROTECTED]
Subject: RE: periodic corruption problem


I had a similar problem with an Oracle database once. It turned out to be
some memory in the process of going bad.

John

-Original Message-
From: Jon Wagoner [mailto:[EMAIL PROTECTED]
Sent: Monday, November 10, 2003 2:24 PM
To: [EMAIL PROTECTED]
Subject: RE: periodic corruption problem


It's been going on for months, so that doesn't seem very likely.  On the
other hand, we have had 2 or 3 other hard drives go bad with other servers
at this host, so I'm not ruling it out.

-Original Message-
From: Big Brother [mailto:[EMAIL PROTECTED]
Sent: Monday, November 10, 2003 12:04 PM
To: Jon Wagoner
Cc: [EMAIL PROTECTED]
Subject: Re: periodic corruption problem


my experience with corrupted tables is usually followed by a failed
harddrive
aka the disk may be diing ...

--



Quoting Jon Wagoner [EMAIL PROTECTED]:

 I am running MySQL 4.0.16 on a Red Hat 7.3 server.  I am having problems
 with tables periodically getting corrupted.  The one it happens most often
 on is a table I use for logging various status messages.  This table
 receives mostly inserts, and very few selects.  It is about 400MB in size,
 with about 1.3M rows.  I just had it happen to another table, that
receives
 mostly selects, and few inserts or updates.  It is only about 60MB in
size,
 with about 95k rows.  Both of these tables rarely have deletes.

 The last time, I believe the error message said something about the index
 being the wrong size.  Sorry I didn't write it down, but I was in a hurry
to
 get things working again.  Can anyone provide some help on this problem?


 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



table gets corrupted often

2003-11-03 Thread Jon Wagoner
I have a table that tends to get corrupted and needs to be repaired every
few days.  It is used for logging various messages in my web app.  The
structure is:

CREATE TABLE log (
  log_id int(11) unsigned NOT NULL auto_increment,
  log_type tinyint(1) unsigned NOT NULL default '0',
  when datetime NOT NULL default '-00-00 00:00:00',
  msg text NOT NULL,
  PRIMARY KEY  (log_id)
) TYPE=MyISAM;

I am running MySQL 4.0.16 on a Red Hat 7.3 server.  There are about 200
other tables in the database, and none of the rest have a problem.

The table has about 200,000-300,000 records added daily, and is cleaned out
every week or so.  I have tried dropping and recreating the table, but that
does not seem to help.  The table is almost exclusively accessed by INSERTs.

Any ideas why this particular table would be so unstable?


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: table gets corrupted often

2003-11-03 Thread Jon Wagoner
The table is currently only about 345MB, so it is not a file size limit.

In response to the other post, the only deletes in this table happen every
week or so when I'm cleaning the table out, so the corruption is not
happening with a delete.

-Original Message-
From: gerald_clark [mailto:[EMAIL PROTECTED]
Sent: Monday, November 03, 2003 2:04 PM
To: Jon Wagoner
Cc: [EMAIL PROTECTED]
Subject: Re: table gets corrupted often


Could it be getting larger than 2G on a filesystem with a 2G/file limit?

Jon Wagoner wrote:

I have a table that tends to get corrupted and needs to be repaired every
few days.  It is used for logging various messages in my web app.  The
structure is:

CREATE TABLE log (
  log_id int(11) unsigned NOT NULL auto_increment,
  log_type tinyint(1) unsigned NOT NULL default '0',
  when datetime NOT NULL default '-00-00 00:00:00',
  msg text NOT NULL,
  PRIMARY KEY  (log_id)
) TYPE=MyISAM;

I am running MySQL 4.0.16 on a Red Hat 7.3 server.  There are about 200
other tables in the database, and none of the rest have a problem.

The table has about 200,000-300,000 records added daily, and is cleaned out
every week or so.  I have tried dropping and recreating the table, but that
does not seem to help.  The table is almost exclusively accessed by
INSERTs.

Any ideas why this particular table would be so unstable?







--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: where drink is not equal to pepsi

2003-03-20 Thread Jon Wagoner
Select * from Tablename where drinks != 'pepsi';

Got any milk with that cookie?

-Original Message-
From: Andrew Wilson [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 20, 2003 6:49 PM
To: '[EMAIL PROTECTED]'
Subject: where drink is not equal to pepsi



Hi guys, 
Hopefully have an easy question for you guys.
Whats wrong with this query


Select * from Tablename where drinks is not = 'pepsi';

Driving me batty..

A cookie for the right answer..

t   8920 8877 
f   8920 8866 
e   [EMAIL PROTECTED] 
w   http://www.netwaynetworks.com.au 


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



RE: Unknown table in field list

2003-02-24 Thread Jon Wagoner
Change the query to:

SELECT parcels.DXF as 'record',
building.ADDRESS as 'results1', parcels.relname as
'results2' from  parcels INNER JOIN building
on parcels.DXF = building.DXF where
parcels.relname LIKE '%jones%' order by
parcels.relname desc;

For tables in the from list, the next word after a table name is considered to be the 
alias, unless it is a keyword.  So, when you had: 
from  parcels building INNER JOIN building as building
since building was immediately after parcels, it thought you wanted to use building as 
an alias for parcels.  You then go on to list building, so according to your query you 
wanted parcels aliased as building, and building also to be called building, so there 
was a conflict.  

-Original Message-
From: Diver8 [mailto:[EMAIL PROTECTED]
Sent: Monday, February 24, 2003 10:47 AM
To: [EMAIL PROTECTED]
Subject: Unknown table in field list


Hi again.

I've tried searching the list archives for this all
morning, but they don't seem to be working (never get
any results, page times out).  I found one report of
this on google but the guy said he figured out the
problem but didn't say what he did to fix it!

I just added a table to my database (about four hours
ago, actually).  This table is called 'building'.  My
overall database looks like this:

mysql show tables;
++
| Tables_in_tmp_db_work  |
++
| building   |
| parcels|
++
2 rows in set (0.00 sec)

I'm trying to run the following query:

mysql SELECT parcels.DXF as 'record',
building.ADDRESS as 'results1', parcels.relname as
'results2' from parcels where parcels.relname like
'%jones%' order by parcels.relname desc;

That query returns:

ERROR 1109: Unknown table 'building' in field list

If I try this query instead:

mysql SELECT parcels.DXF as 'record',
building.ADDRESS as 'results1', parcels.relname as
'results2' from  parcels building INNER JOIN building
as building on parcels.DXF = building.DXF where
parcels.relname LIKE '%jones%' order by
parcels.relname desc;

The query returns:

ERROR 1066: Not unique table/alias: 'building'

So what's wrong??

Thanks.



__
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



optimizing large InnoDB table

2003-02-24 Thread Jon Wagoner
I have a couple of questions here.  This table currently contains about 12 million 
records.  This table is mostly read from, but several times thoughout the day there 
will be inserts or updates of batches of about 30,000 rows, and there are periodic 
purges of old rows, which could be up to several million rows.  The table has 1 index 
over three of the columns.  My questions are:

1.  There is one varchar(15) column, that is part of the index.  Would there be any 
performance benefit to making it a char column?
2.  Does InnoDB do updates/deletes row by row, even if it is just one query?
3.  Will it just update the index once per query, or for each row?
3.  Any other advice for speeding up the updates/deletes?

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



RE: case expression

2003-02-24 Thread Jon Wagoner
Put the other fields after the CASE statement:

SELECT 
  CASE 
WHEN CHARACTER_LENGTH(system)  65 
THEN 
  CONCAT(LEFT(system, 60),  ...)
ELSE
  system
  END, 
  wsh_year, 
  id 
FROM  wsh

The CASE statement just returns 1 field.

-Original Message-
From: Richard Forgo [mailto:[EMAIL PROTECTED]
Sent: Monday, February 24, 2003 3:21 PM
To: 'MySQL Mailing List'
Subject: case expression


Hello all ... be gentle, I'm new at this:

I've got a simple case query.  One works (the top one), but when I try
to add additional columns to the query it fails.  I reckon it's a pretty
simple mistake I'm making, but I don't know what.  Any help is
appreciated.

-
This works ...

SELECT  CASE WHEN CHARACTER_LENGTH(system)  65 then
  CONCAT(LEFT(system, 60),  ...)
ELSE
system END

--

This doesn't ...

SELECT  CASE WHEN CHARACTER_LENGTH(system)  65 then
  CONCAT(LEFT(system, 60),  ...), wsh_year, id
ELSE
  system, wsh_year, id END
FROM  wsh

Maybe an IF statement would work better here?

Rik Forgo
JIST3
Army Test, Training and Technology Integration Office (T3I)
Diverse Technologies Corp.
(c) 443.463.8571
(h) 410.859.8474


 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)
 
 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail mysql-unsubscribe-
 [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



RE: case expression

2003-02-24 Thread Jon Wagoner
Consider the CASE statement to be a function, that can only return values.  Aliases 
would go outside the CASE STATEMENT, as follows:

SELECT 
  CASE 
WHEN CHARACTER_LENGTH(system)  65 
THEN 
  CONCAT(LEFT(system, 60),  ...)
ELSE
  system 
  END AS system, 
  wsh_year, 
  id 
FROM  wsh

-Original Message-
From: Richard Forgo [mailto:[EMAIL PROTECTED]
Sent: Monday, February 24, 2003 3:44 PM
To: Jon Wagoner; 'MySQL Mailing List'
Subject: RE: case expression


Thanks, that works fine.  If I wanted to create an alias for the column,
how would I do that?  The first select statement (before the Else) is
the current column name.

When I add 'AS system' to the end of the string, it fails.

Ex.

SELECT 
  CASE 
WHEN CHARACTER_LENGTH(system)  65 
THEN 
  CONCAT(LEFT(system, 60),  ...)
ELSE
  system AS system
  END, 
  wsh_year, 
  id 
FROM  wsh

Rik Forgo
JIST3
Army Test, Training and Technology Integration Office (T3I)
Diverse Technologies Corp.
(c) 443.463.8571
(h) 410.859.8474


 -Original Message-
 From: Jon Wagoner [mailto:[EMAIL PROTECTED]
 Sent: Monday, February 24, 2003 4:34 PM
 To: Richard Forgo; MySQL Mailing List
 Subject: RE: case expression
 
 Put the other fields after the CASE statement:
 
 SELECT
   CASE
 WHEN CHARACTER_LENGTH(system)  65
 THEN
   CONCAT(LEFT(system, 60),  ...)
 ELSE
   system
   END,
   wsh_year,
   id
 FROM  wsh
 
 The CASE statement just returns 1 field.



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php