RE: How to SELECT something (CONCAT) and search the field

2005-06-23 Thread Ben Kutsch
the substring will only work as long as you don't have spaces in the first
and last name columns
'Billy Ray' Smith and John 'Von Hoenhiem' would cause problems

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 23, 2005 4:05 PM
To: Matt Babineau
Cc: mysql@lists.mysql.com
Subject: Re: How to SELECT something (CONCAT) and search the field


Hi,
what's your version ? in 4.11 the two forms work :
mysql select  concat(firstname,' ','lastname') from names;
+--+
| concat(firstname,' ','lastname') |
+--+
| Jean lastname|
+--+
1 row in set (0.00 sec)

mysql select firstname,lastname from names where concat(firstname,'
','lastname') like '%J%';
+---+--+
| firstname | lastname |
+---+--+
| Jean  | Dupond   |
+---+--+
1 row in set (0.00 sec)

mysql select firstname,lastname from names where
concat(rtrim(ltrim(firstname)),' ',lastname) like '%Jean Dupond%';
+---+--+
| firstname | lastname |
+---+--+
| Jean  | Dupond   |
+---+--+
1 row in set (0.02 sec)


mysql select firstname,lastname from names where concat(firstname,'
',lastname)
like 'Jean Dupond';
+---+--+
| firstname | lastname |
+---+--+
| Jean  | Dupond   |
+---+--+
1 row in set (0.00 sec)


BUT i Think that :
*
to use index on firstname or lastname, it's better to split $user rather
than
concat the two columns :

mysql select firstname,lastname from names where firstname like
substring_index('%Jean Dupond%',' ',1);
+---+--+
| firstname | lastname |
+---+--+
| Jean  | Dupond   |
+---+--+
1 row in set (0.00 sec)

mysql select firstname,lastname from names where lastname like
substring_index('%Jean Dupond%',' ',-1);
+---+--+
| firstname | lastname |
+---+--+
| Jean  | Dupond   |
+---+--+
1 row in set (0.00 sec)

Mathias

Selon Matt Babineau [EMAIL PROTECTED]:

 Hey All-

 Got a fun question - I hit the manual but not much luck on my question. I
 want to combine 2 fields and then search them

 SELECT first_name, lastname FROM user WHERE CONCAT(first_name, ' ',
 last_name) LIKE '%$user%'

 Does this make sense? The CONCAT function was the closest I found to try
and
 do what I want to do. I alread tried this:

 SELECT concat(first_name, ' ', last_name) as fullname FROM user...

 This did not work. If anyone has any ideas on how to search for users when
 the first_name and last_name fields are broken up I'm all ears!


 Thanks,

 Matt Babineau
 Criticalcode
 858.733.0160
 [EMAIL PROTECTED]
 http://www.criticalcode.com



 --
 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]



innodb error 995

2005-02-14 Thread Ben Kutsch
Hi I'm running version MySQL 4.0.20a-debug
windows server 2003
on a dedicated database server with an external SCSI RAID array with a  
1 TB of disk space  (over 400 GIG free)

1 gig of RAM
basic settings
key buffer 512 MB
sort Buffer 32 Mb
innof db
Buffer Pool Size 512 MB
my innodb datafile is about 200 gig is size and I have 6 innodb  
databses. 3 are very large 40+ gigs with about 800 million records.
The other 3 are very small few MB is size. Every two weeks I rebuild  
one of the large db and use the other 2 as backups.
This configuration as worked fine for the last 2 months.

I was in the process of rebuilding one of the large databases when I  
got the following error.

050214 16:46:56  InnoDB: Operating system error number 995 in a file  
operation.
InnoDB: See http://www.innodb.com/ibman.php for installation help.
InnoDB: See section 13.2 at http://www.innodb.com/ibman.php
InnoDB: about operating system error numbers.
InnoDB: File name .\ibdata1
InnoDB: File operation call: 'Windows aio'.
InnoDB: Cannot continue operation.

after restarting mysql, innodb rolled back my tables in the db that  
crashed and the rest of my data seems fine.

I have googled around and there seems to be some info that this errors  
is some kind windows driver. Is there any more info regarding this  
error?

Any help would be useful.
Thank you
-Ben
 
--
Ben Kutsch		 		Developer
Suite 304, 121 South 13th ST   	Dept. of Computer Science and Eng.
phone: (402) 472-2340			University of Nebraska-Lincoln
fax: (402) 472-3135   		Lincoln NE 68588-0115
email: [EMAIL PROTECTED]   	http://nadss.unl.edu
 
--

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