Re: Text field how to handle aliases
Hi, For this only RDBMS came into being. You keep your master data in a table with relevent descriptions, codify the item. Use the code in other location. In qa web page always search against/show the full desc of what others require. Add a category like school/university/pre-matric etc. this could simplify the visitor to make logical and correct naming methods. In a nutshell when accepting info from users, show them the full desc/ask them write the full desc, add a category. I hope this could solve ur problem. On Tue, 19 Oct 2004 12:38:49 -0500, Lewick, Taylor [EMAIL PROTECTED] wrote: I need help on the best way to handle a field that could have many different ways of naming something. For instance, school name Let's take Saint Joseph's University This could be Saint Joseph's Univeristy, U. of St. Joe, SJU, Univ. St. Joe, etc... In this case, I don't think I can always get what I want by doing a select from table where name like something. Is there a practical/better way to handle this kind of thing. This will come up a lot. I'm thinking right now I will have to maintain my own mapping file for each school... Something like Kansas, KU, Kansas University, University of Kansas, etc... Any ideas? Thanks, Taylor -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- Thanks Regards, Eldo Skaria -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Delete duplicate entry
Hi, I think the query has to be considering the count rather than the sum. the query can be like this: select pkfield1[,pkfield2[,pkfield3[,]]], count(1) from your_table group by pkfield1[,pkfield2[,pkfield3[,]]] having count(1) 1 Here u can add n-number of feilds which u want make PK. Reg, Eldo. On Fri, 08 Oct 2004 09:37:11 +1000, Daniel Kasak [EMAIL PROTECTED] wrote: gerald_clark wrote: Batara Kesuma wrote: Hi, I have a table that looks like: CREATE TABLE `message_inbox` ( `member_id` mediumint(8) unsigned NOT NULL default '0', `message_id` int(10) unsigned NOT NULL default '0', `new` enum('y','n','replied') NOT NULL default 'y', `datetime` datetime default NULL, KEY `idx_1` (`member_id`,`new`), KEY `idx_2` (`member_id`,`datetime`) ) TYPE=InnoDB Now, I want to add a primary key to it. ALTER TABLE message_inbox ADD PRIMARY KEY (member_id, message_id) But there are already some duplicated entries. ERROR 1062: Duplicate entry '10244-80871' for key 1 How can I tell MySQL to delete the duplicated entry and continue to make primary key? Is there any efficient way to do this? Thank you very much. try ALTER IGNORE TABLE. That hardly seems like a solution. If the above works, then I'd call that 'feature' a bug. You need to remove the duplicates from your table before creating a primary key, otherwise what are you creating the key for in the first place? Create a query that finds the duplicates. Choose the ones you want to delete, and delete them manually. In your particular case, as you're trying to put a key across 2 columns, you really do have a problem. I'd *usually* suggest something like: select sum(1) as number_of_duplicates, my_key_field from my_table group by my_key_field having sum(1)1 However this won't work if your key is going to go across more than one field. I suppose you could concat() the fields together. It's not exactly the perfect solution, but it sounds like you don't exactly have perfect data to start with, and since you're doing this manually, you can deal with it. Try something like: select sum(1) as number_of_duplicates, concat(member_id, '___', message_id) as my_problem from message_inbox group by concat(member_id, '___', message_id) having sum(1)1 Have fun. Dan -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- Thanks Regards, Eldo Skaria -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: CREATE VIEW gets all mangled up when doing SHOW CREATE VIEW
Hai Martin, I suppose these are the ways with Databases. They don't work the way we like them to. So please adjust with it. For this matter I think, any RDBMS will be doing their or paddings to the scripts when they are loading it in memories. just the same way for oracle(where i have some (in)experience). so, don;'t worry, be happy. Regards, Eldo. On Wed, 29 Sep 2004 11:57:22 +0200, Martijn Tonies [EMAIL PROTECTED] wrote: Hi there, I'm testing MySQL 5.0.1 a bit - and I noticed the following... When executing this: create view myview2 (t0) as select c1 from t It returns this when doing a SHOW CREATE VIEW myview2: CREATE VIEW test.myview2 AS select `test`.`t`.`c1` AS `t0` from `test`.`t` This is not at all what I entered. I dislike backticks unless I specify them. I don't want a database name included unless I specify it (from `test`.`t`). Can the annoying behaviour be changed or turned off? With regards, Martijn Tonies Database Workbench - developer tool for InterBase, Firebird, MySQL MS SQL Server. Upscene Productions http://www.upscene.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- Thanks Regards, Eldo Skaria -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: MySQL Order by 2 date fields
Hi Khan, I would klike to approach ur problem in a diffrent manner. My suggestion is that, in both the date fields u use dates only. (I don't know the useabilty of '0' in a date field). While using this, u have to store the creation time a the modification time, at the creation of record. This is the technique we are using very extensivey in our application to store creation and modifcation time as well as users. Here when there is no modification, the the creation time will be used for processing, which is same as modfy time. So always you need to order against the modify time only. You may find it difficult to adjust ur application so that it processes the modification time in the new fashion. this has an advantage that, during sorting, it uses less resources, hence a fster query is resulted. further, if ur table is having hundreds of thousands of records, then ur order by clause with functions will become all the more process intensive as compared to a direct filed sorting. reg, Eldo. On Mon, 4 Oct 2004 10:06:03 +0100, Paul [EMAIL PROTECTED] wrote: On Mon, 4 Oct 2004 11:03:13 +0200, Martijn Tonies [EMAIL PROTECTED] wrote: Hello, I have two date fields (1095689105) in mysql. One is Creation date and other is Modify date. If news is not modified its value is 0. How can I sort my news so modify date is more important (if exists) than creation date? What about an ORDER BY with a CASE statement that uses the CreationDate if ModifyDate = 0 and ModifyDate if it's 0. With regards, Or use: ORDER BY if(ModifyDate = 0,1, ModifyDate), CreationDate Paul -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- Thanks Regards, Eldo Skaria -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Problem with insert statement; ERROR 1030 at line 188: Got error 28 from table handler
Hi Sebastian, If the new cds_catalog is created with primary key, this should produce a duplicate key error for the second iteration of the second table, as the data selected is from cds_catalog alone, but joining two tables causing cartisian joint to be formed(n*(m- t1.fieldt2.field)), each time the same set of data being inserted. reg, Eldo. On Mon, 27 Sep 2004 14:07:54 +0200 (CEST), Tobias Asplund [EMAIL PROTECTED] wrote: On Mon, 27 Sep 2004, Sebastian Geib wrote: I have a huge problem with the following insert statement: INSERT INTO cds_catalog SELECT cds_stage.cds_catalog.* FROM cds.cds_catalog, cds_stage.cds_catalog WHERE cds_stage.cds_catalog.prodidcds.cds_catalog.prodid; Look at this query, it will create a huge table as a result, as an approximisation the table created will have the number of rows in both tables multiplied with eachother. Has anyone else any idea? I tried all Google resources I could get hands on, but they were all about disk space on the tmp partition or repairing the db which both isn't the problem here. Are you sure 60GB is enough? Look above, say you have 1000 rows in each table, the result could be up to 100 rows. -- 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: bulk loading of data
Hi David, I think you can try pipes(hope u r using linux/unix). this is a method we used to export/sqlload for oracle. craete a pipe file, say abc.txt(mkfile -p abc.txt). start the the dumpfile reading in bg(should be run first). start the dump-file generation of C++. with this setup we could save a lot of time and space. i have not tried this for mysql. this is only my suggestion. goog luck. Eldo. On Fri, 24 Sep 2004 15:28:43 -0500 (CDT), David Mehringer [EMAIL PROTECTED] wrote: Hello, I have a C++ application which spits out data continuously which I need to load into a database. The data rate is roughly 50,000 rows * 50 bytes/row per second. I use LOAD DATA INFILE (the quickest way I can find to load data into the db) to load these data into MyISAM tables which is accomplished by continously running another C++ application which uses the MySQL C API (which ultimately runs LOAD DATA INFILE). In order to do this, I have modified the first app to write the data to ASCII files as required by LOAD DATA INFILE. The problem is that there is a bottleneck in organzing the data (which I do by appending to C++ strings) and then dumping the strings to the flat files, so I'm looking for ways to increase the performance in this area. Writing binary data would be faster. Does MySQL support something similar to LOAD DATA INFILE for loading data from binary files? Is there a faster way of getting the data into the db without having to dump it to flat files? I've tried INSERTs, writing code which essentially bridges the two apps, but of course INSERTs are much slower than LOAD DATA INFILE. The data types themselves are simple: ints, smallints, text, doubles, and floats. Thanks for any help. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- Thanks Regards, Eldo Skaria -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: reg backup
Hai Lakshmi, Backup I am yet to learn. transactional tables-limited knowledge- transaction safe tables are the ines in which you will be able to rollback the changes u made to the db since last commit or rollback. to check is innodb is running(rather enabled), in linux u may use the command mysqladmin -hhost -p[if passwd is reqd] variables | grep -iw innodb this should show a line Innodb Enabled/Disabled Eldo Skaria On Fri, 24 Sep 2004 20:13:56 +0530, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, Is there any way to handle backup in the mysql 4.0 classic with out innoDB?. And may i know the differences between transaction - safe and transaction -full locks ?. And what is the best way to confirm whether innodb is running or not in mysql 4.0?. Thanks, Narasimha -Original Message- From: Egor Egorov [mailto:[EMAIL PROTECTED] Sent: Fri 9/24/2004 2:41 PM To: [EMAIL PROTECTED] Cc: Subject: Re: Which file to backup Luciano Barcaro [EMAIL PROTECTED] wrote: I'm trying to backup the 'binary log' and don't know which file is it. these are the files I see in my datadir -rw-rw 1 mysql users175K Sep 14 14:21 hrrgp01-bin.07 -rw-rw 1 mysql users345K Sep 14 15:03 hrrgp01-bin.08 -rw-rw 1 mysql users1.6M Sep 14 15:18 hrrgp01-bin.09 -rw-rw 1 mysql users3.9M Sep 15 09:06 hrrgp01-bin.10 -rw-rw 1 mysql users 29K Sep 15 09:11 hrrgp01-bin.11 -rw-rw 1 mysql users676K Sep 15 15:58 hrrgp01-bin.12 -rw-rw 1 mysql users4.4M Sep 16 11:10 hrrgp01-bin.16 -rw-rw 1 mysql mysql322M Sep 16 11:10 ibdata1 -rw-rw 1 mysql users 40M Sep 16 11:10 ib_logfile0 The thing is I intend to stop the server at a certain time and then make a backup copy of the actual binary log. But which is the name of the file I should use into my script? Backup *-bin.* and ib_logfile* if you use InnoDB. And don?t forget ibdata1 The question was about logs. -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ __ / |/ /_ __/ __/ __ \/ /Egor Egorov / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net ___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately and destroy all copies of this message and any attachments. -- Thanks Regards, Eldo Skaria -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Anomaly in date subtraction
Hi Everybody, The following is my scenario: mysql select mop_id, job_id, end_time, start_time, end_time-start_time from bjs_stat where sol_id = ''; +++-+-+-+ | mop_id | job_id | end_time| start_time | end_time-start_time | +++-+-+-+ | ABH| CDCIK | 2004-09-01 21:29:07 | 2004-09-01 21:29:03 | 4 | | ABH| DFILE | 2004-09-01 21:28:58 | 2004-09-01 21:28:58 | 0 | | ABH| EODBA | 2004-09-01 21:28:59 | 2004-09-01 21:28:58 | 1 | | ABH| EODDP | 2004-09-01 21:26:36 | 2004-09-01 20:58:23 | 6813 | | ABH| FEDRP | 2004-09-01 21:29:02 | 2004-09-01 21:28:59 | 43 | | ABH| FFDAC | 2004-09-01 20:58:20 | 2004-09-01 20:58:19 | 1 | | ABH| FSLRP | 2004-09-01 21:28:57 | 2004-09-01 21:28:50 | 7 | | ABH| LLIEN | 2004-09-01 21:26:41 | 2004-09-01 21:26:39 | 2 | | ABH| RECSF | 2004-09-01 21:26:39 | 2004-09-01 21:26:36 | 3 | | ABH| TDCHK | 2004-09-01 21:29:12 | 2004-09-01 21:29:07 | 5 | | ABH| TODTD | 2004-09-01 21:29:03 | 2004-09-01 21:29:02 | 1 | | ABH| TXOD | 2004-09-01 20:58:23 | 2004-09-01 20:58:20 | 3 | | CBOD | EODAF | 2004-09-01 04:05:27 | 2004-09-01 04:05:11 | 16 | | CBOD | EXCPD | 2004-09-01 04:04:51 | 2004-09-01 04:04:45 | 6 | | CBOD | INOPR | 2004-09-01 04:05:30 | 2004-09-01 04:05:27 | 3 | | CBOD | INTFC | 2004-09-01 04:04:54 | 2004-09-01 04:04:51 | 3 | | CBOD | INTFD | 2004-09-01 04:04:55 | 2004-09-01 04:04:54 | 1 | | CBOD | INTKD | 2004-09-01 04:04:56 | 2004-09-01 04:04:55 | 1 | | CBOD | INTRD | 2004-09-01 04:04:57 | 2004-09-01 04:04:56 | 1 | | CBOD | INTSB | 2004-09-01 04:09:33 | 2004-09-01 04:09:29 | 4 | | CBOD | LADGF | 2004-09-01 04:09:21 | 2004-09-01 04:09:11 | 10 | | CBOD | LADGN | 2004-09-01 04:09:11 | 2004-09-01 04:08:18 | 93 | | CBOD | LADSP | 2004-09-01 04:09:29 | 2004-09-01 04:09:22 | 7 | | CBOD | MISTD | 2004-09-01 04:08:18 | 2004-09-01 04:05:30 | 288 | | CBOD | REGFL | 2004-09-01 04:05:11 | 2004-09-01 04:05:07 | 4 | | CBOD | SSS| 2004-09-01 04:04:45 | 2004-09-01 04:04:40 | 5 | | CBOD | TDS| 2004-09-01 04:05:06 | 2004-09-01 04:04:57 | 49 | - | ISOLOP | BGREP | 2004-09-01 07:37:51 | 2004-09-01 07:37:49 | 2 | | ISOLOP | DEPRP | 2004-09-01 07:37:53 | 2004-09-01 07:37:51 | 2 | | ISOLOP | DOCRP | 2004-09-01 07:37:55 | 2004-09-01 07:37:53 | 2 | | ISOLOP | EXCPE | 2004-09-01 07:37:49 | 2004-09-01 07:37:47 | 2 | | ISOLOP | FBDLK | 2004-09-01 07:37:57 | 2004-09-01 07:37:55 | 2 | | ISOLOP | FFDAR | 2004-09-01 07:38:00 | 2004-09-01 07:37:58 | 42 | - | ISOLOP | FFDVR | 2004-09-01 07:38:03 | 2004-09-01 07:38:02 | 1 | | ISOLOP | IDREP | 2004-09-01 07:37:58 | 2004-09-01 07:37:57 | 1 | | ISOLOP | TODRP | 2004-09-01 07:38:02 | 2004-09-01 07:38:00 | 2 | +++-+-+-+ 36 rows in set (0.00 sec) mysql desc bjs_stat; ++-+--+-++---+ | Field | Type| Null | Key | Default| Extra | ++-+--+-++---+ | sol_id | varchar(8) | | PRI || | | bod_date | date| | PRI | -00-00 | | | mop_id | varchar(10) | | PRI || | | job_id | varchar(5) | | PRI || | | start_time | datetime| YES | | NULL | | | end_time | datetime| YES | | NULL | | | user_id| varchar(15) | YES | | NULL | | ++-+--+-++---+ 7 rows in set (0.00 sec) While in the query when I am checking for the diff in time, records shown just above the underlines are interesting. When the actual time diff is less than 10 secs, result shows 40 secs. Is this a bug? My version is mysql-max 4.1.1 The table was created using load data local inflie at mysql prompt from a plain text separated with '|'. Can any patrons help me? Thanking in Advance, Eldo
Re: Anomaly in date subtraction
That seems to be vague to me. I would like to know how the time is converted to numbers? is it upto seconds or even beyond that? happier if resolved, Thanks in advance. reg, Eldo. On Tue, 21 Sep 2004 21:46:02 +0300, Gleb Kozyrev [EMAIL PROTECTED] wrote: Time is converted to numbers then subtracted. -- With best regards, Gleb Kozyrev. -- Thanks Regards, Eldo Skaria -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: the table is read only
Hi, Giving a permission of '777' to mysql dir is not advisable. More over that may not be the problem. It should be the privilege the phpmyadmin user is having on your Db or the specified table. Reg, Eldo Skaria On Wed, 22 Sep 2004 08:36:21 +0800, [EMAIL PROTECTED] wrote: Hi I have installed mysql some software on aix5.2 . the edition is MySQL-3.23.58-2.aix5.1.ppc but when I used phpmyadmin to manage the mysql it told me ** #1036 - Table 'gbook' is read only *** while I have granted the data dir(/var/lib/mysql) 777 permission how to resolve it ? help me please ,how to resolve thanks a lot Yours LiRui [EMAIL PROTECTED] 2004-09-20 -- Thanks Regards, Eldo Skaria -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Duplicate Entries
Hi, Suresh may be expressing that he has a primary key with two fields. Eldo. On Tue, 21 Sep 2004 19:32:17 -0400, Rhino [EMAIL PROTECTED] wrote: - Original Message - From: Suresh [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 21, 2004 6:43 PM Subject: Duplicate Entries Hello All, I am porting from 4.0.0-alpha-nt to 4.0.1-alpha-nt. In which i have a table with two primary key, my older mysql server insert all the records except the duplicate fields(Primary Key). Whereas in the new mysql server it exits whenever it sees a duplicate entry. How to resolve it ? Am I understanding you correctly? It *sounds* like you're saying that you have a table with TWO primary keys. As far as I know, it is not possible to have two separate primary keys in a single table under any circumstances. Do you mean that you have a single primary key that has two columns in it? Rhino -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- Thanks Regards, Eldo Skaria -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Anomaly in date subtraction
HI Daly, Thanks A lot. Eldo Skaria. On Tue, 21 Sep 2004 16:09:03 -0500, Eamon Daly [EMAIL PROTECTED] wrote: Just to be a little more clear, when you're doing the subtraction like so: 2004-09-01 07:38:00 - 2004-09-01 07:37:58 MySQL converts each to numeric representations thusly: 20040901073800 - 20040901073758 which, like most things in the universe, equals 42, /not/ the 2 I think you were expecting. What you need to do is convert the times to seconds and /then/ subtract: mysql select * from whee; +-+-+ | start | end | +-+-+ | 2004-09-01 07:37:58 | 2004-09-01 07:38:00 | +-+-+ 1 row in set (0.00 sec) mysql SELECT end - start AS numeric_calc, - TIME_TO_SEC(end) - TIME_TO_SEC(start) AS time_calc - FROM whee; +--+---+ | numeric_calc | time_calc | +--+---+ | 42 | 2 | +--+---+ 1 row in set (0.00 sec) Eamon Daly - Original Message - From: Gleb Kozyrev [EMAIL PROTECTED] To: Eldo Skaria [EMAIL PROTECTED] Cc: MySQL List [EMAIL PROTECTED] Sent: Tuesday, September 21, 2004 2:31 PM Subject: Re: Anomaly in date subtraction On Wed, 22 Sep 2004 00:20:32 +0530, Eldo Skaria [EMAIL PROTECTED] wrote: That seems to be vague to me. I would like to know how the time is converted to numbers? is it upto seconds or even beyond that? happier if resolved, It is converted in such a way that looking at number we can easily read the date mysql select now(), now() + 0; +-++ | now() | now() + 0 | +-++ | 2004-09-21 22:29:30 | 20040921222930 | +-++ Please read the manual. 6.3.4 Date and Time Functions -- With best regards, Gleb Kozyrev. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- Thanks Regards, Eldo Skaria -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Stupid Newbie Query Help with AND and OR logical operators
Bob Cohen wrote: Here's my question. I wrote this query: Select * FROM name WHERE last LIKE d AND choice1=2 OR choice2=2 OR choice3=2; What I'm looking for are records that satisfy the LIKE d condition But then, Only one of the three other conditions need be true: choice1=2 choice2=2 choice3=2 I want to cover the possibilities, e.g., choice1=2 choice2=1 choice3=1 choice1=1 choice2=2 choice3=whatever Or choice1=1 choice2=1 choice3=2 Does this make sense? The query I've written doesn't seem quite right. Because of the AND following the LIKE d condition, it seems like all the records will have to have choice2 equaling 2. Some help clarifying this issue would be appreciated. Thanks. Bob Cohen b.p.e.Creative http://www.bpecreative.com Design and production services for the web Put creative minds to work for you Bob, You should have used some paranthese to separate the clauses u want for or. You may be getting errors because of the operator precedence. 'And' is having higher precedence than 'or'. Further like should be used with wildcard chars '%' or '_' .I fu re-write ur qry like Select * FROM name WHERE last LIKE %d% AND (choice1=2 OR choice2=2 OR choice3=2); //This gives all recs where last is having char d anywhere in the string. // 'd%' - starting with 'd' // '%d' - ending with 'd' ur next reqrmnet. If u want to cover all possibilities in singlr querry u should use 'IN' operator like (choice1 IN (2,1) or choice2 IN (1,2)). Else u may have to use separate qrys. reg, Eldo Skaria. -- #---# # Viva OpenSource # #---# -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]