Re: how to solve NOT problem?
I think your confusion stems from the fact that a AND b NOT c is not a valid boolean expression. You probably mean to say a AND b AND NOT c Lezz Giles - Original Message - From: "Libor Maty" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Saturday, September 15, 2001 5:25 AM Subject: how to solve NOT problem? hi, i'm having the following problem that sort of makes my life miserable :-) i've been working on a search script that could take a query like this: (car and bus) or apple not (orange and table)etc. ...basicly any logical statement...and return the right references based on searching specified fields in the database. the script so far basicaly breaks down the query and searches specified fields for words in the query. the result of this search is then stored in a temporary table where the most important field is always a field f consisting of all the words from the query that were found in a particular row of fields in the main database. so the result could look like this: ref_id a b..f 1 1 0..car bus orange 2 0 0..car bus 3 1 1..car apple table 4 0 1..apple now, i need to convert the input query into a sql query that could be used with mysql. it all works fine if there are no "NOT" logical operators. for example: (car and bus) or apple would convert to SELECT * FROM T WHERE (((f LIKE "%car%") AND (f LIKE "%bus%")) OR (f LIKE "%apple%")) and returns the right results but when i use NOT i can't beleive that one cannot use NOT but has to use something like "f NOT LIKE" instead which so much complicates the whole thing. does anybody have a short solution to this, before i start working on a converting mechanism? remember, that i strive for as simple script possible...so i'm looking for a way of simply going from a AND b NOT c to f like a AND f like b NOT f like c ...or something in that sence. thanks a lot for your help. libor matyas - 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: surely an easy quick one
I haven't tested this; I'm not an SQL guru. I just like a challenge :-) SELECT COUNT(*) FROM table WHERE team = support GROUP BY name; Lezz Giles - Original Message - From: Jamie Burns [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, September 14, 2001 9:08 AM Subject: surely an easy quick one Hello again :o) This is surely an easy quick one but my brain wont work! I have a table (ref, name, team, seminar_ref) like: 1billsupport100 2billsupport101 3billsupport102 4ben development 201 5ben development 103 6ben development 204 7bob support 104 8bob support102 9bob support107 7pat support 102 8pat support 202 9pat support 105 I need to get a count of how many individual people are in the table, that belong to a certain group. So if I wanted to find all individual people in support the answer in this case it would be 3 (bill, bob and pat). I dont need their names, just the count. Thanks, Jamie. - 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: surely an easy quick one
Yup, you're right. I told you I wasn't an SQL guru :-) How are you running the query, and what do you want to do with the number? If you're calling it from Perl then you could run a variant of the query I gave and just look at how many rows there are in the result. On the other hand, I think if you have a recent MySQL (I don't, so I can't test this) you can say... SELECT COUNT(DISTINCT name) FROM table... HTH Lezz Giles - Original Message - From: Jamie Burns [EMAIL PROTECTED] To: Lezz Giles [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, September 14, 2001 9:56 AM Subject: Re: surely an easy quick one this doesnt work as i need either :o( it returns 3 rows, each with a count of 3 inside. i just want to get a *single row* with the number 3 in it (for my example). :o( thanks for trying though... - Original Message - From: Lezz Giles [EMAIL PROTECTED] To: Jamie Burns [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, September 14, 2001 2:29 PM Subject: Re: surely an easy quick one I haven't tested this; I'm not an SQL guru. I just like a challenge :-) SELECT COUNT(*) FROM table WHERE team = support GROUP BY name; Lezz Giles - Original Message - From: Jamie Burns [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, September 14, 2001 9:08 AM Subject: surely an easy quick one Hello again :o) This is surely an easy quick one but my brain wont work! I have a table (ref, name, team, seminar_ref) like: 1billsupport100 2billsupport101 3billsupport102 4ben development 201 5ben development 103 6ben development 204 7bob support 104 8bob support102 9bob support107 7pat support 102 8pat support 202 9pat support 105 I need to get a count of how many individual people are in the table, that belong to a certain group. So if I wanted to find all individual people in support the answer in this case it would be 3 (bill, bob and pat). I dont need their names, just the count. Thanks, Jamie. - 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: MySQL and Perl
PHP, Perl, Python, etc are all good ways to generate web pages, and they all get on with MySQL perfectly well (OK, I've only used Perl, but I've heard a lot about PHP and a little about Python). My personal input re Perl v. PHP is that PHP is great for people starting CGI stuff if they know HTML first - it lets you create web pages and embed bits of programs. Perl, on the other hand, is better if you know programming first, or if you want complete flexibility. Also note that the Perl DBI interface means that it is relatively simple to move from one database engine to another, but PHP only supports a limited number of database engines. Lezz Giles - Original Message - From: Nilesh Parmar [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, September 10, 2001 8:13 PM Subject: MySQL and Perl Hi I just wanted to know how well MySQL gels with Perl, when compared to MySQL and PHP. any ideas ?? regards Nilesh - 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: weird error that I have not encountered in 2 years
I'm not a mysql person, but I've seen similar stuff. I think that for some reason Unix thinks that the file you're trying to execute is not an executable, so it is trying to run it as a shell script. Try this first: file /usr/local/mysql/bin/mysql and when it tells you that it is a text file, use an editor to look at the contents of the file. You'll almost certainly find that it contains SQL commands instead of being the executable image that it should be. HTH Lezz Giles - Original Message - From: christopher sagayam [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, August 31, 2001 3:01 PM Subject: weird error that I have not encountered in 2 years can anyone please tell me what is happening here ? [root@ns dump]# /usr/local/mysql/bin/mysql /usr/local/mysql/bin/mysql: DROP: command not found /usr/local/mysql/bin/mysql: syntax error near unexpected token `(' /usr/local/mysql/bin/mysql: /usr/local/mysql/bin/mysql: line 12: `CREATE TABLE badwordstable (' [root@ns dump]# Thanks chris _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.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
Re: Borland MySQL client
I'm new to the list,though I've been using MySQL in relatively simple modes for some time now. If you want to join three tables, t1, t2, t3. If you want to select from t1 where t1.c2 has a value in t2.c12 AND where t1.c3 has a value in t3.c13, then first make sure that t1.c2 and t2.c12 have similar types (e.g. both char(10)), then make sure that t1.c3 and t3.c13 have similar types, then create four indexes (one each for t1.c2, t1.c3, t1.c12 and t1.c13). Then the query should be something like SELECT t1.* FROM t1,t2,t3 WHERE t1.c1 = t2.c12 AND t1.c3 = t3.c13; You should also read up as much as you can on EXPLAIN, and you should use EXPLAIN on any SELECT that might end up being really big. HTH, Lezz Giles Frederick L. Steinkopf wrote: I can't comment on whatever Borland client you're talking about but MySQL supports multiple table joins. It's all in your sql coding. I built a yellow pages directory using MySQL that consists of several tables. One has 500,000 records another has 2,000,000 records, others are smaller having between 3 and 1000 records. Most calls involve joining both the two large tables and three or four of the smaller tables. Fred Steinkopf - Original Message - From: Erlend Stromsvik [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, August 06, 2001 7:45 AM Subject: Re: Borland MySQL client Hi I having a little trouble with mysql, with the lack of sub-selects. Yes, I have read about joins, both the manual and from the MySQL book by Paul Dubois, but none of those provide any 'real' info about what to do. It's ok to do join on table1, table2 and table3 as long as they are limited to 10 records each, as in all of the examples you find on the net. But what about my tables. I have one with 1,14 million and one with 136.000 and a third with 65.000 records. What I want to do is to check for a match between a record from table1 in table2 and from table1 to table3 ex. from table1 to 2: select * from table1 where col1 in (select col2 from table2); If I where to do a join on those tables I would, to my knowledge, end up with a temp table with 1,14 * 136.000 * 65.000 records.. And that's a HUGE table. I'm actually not even going to try it, because I'm pretty sure it won't work. The only solution I seem to find, is to include two new columns in table1, where you give them either TRUE or FALSE based on the info put into table2 and table3. So whenever I do an insert in table2 or 3, I also update corresponding record in Table1 with TRUE in either one of the two columns. - Would this be the 'right' way to do it? :) This way I only have to retrieve the record from table1, check for TRUE value in the two columns, if they are TRUE retrieve record from table2 and from table3. Would be nice to hear from someone who manages good sized databases. Regards Erlend Stromsvik - 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 -- Leslie Giles Software Release Manager Avici Systems Inc [EMAIL PROTECTED] Phone: 978.964.2030 Fax: 978.964.2100 Do not fear the merge - 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
Cannot change column type from varchar(32) to char(32)
I'm running 3.21.33b (yes, I know it's old), and I run the command: alter table branch change codebase codebase char(32) not null default IPriori; where column codebase has type varchar(32) - but the type does not change to char(32). There's no error message or other indication of what went wrong, and if I create a little play table I can succesfully change the column type to char(32) from varchar(32). The table branch has just 180 rows in it. I'd like to change the column types from varchar to char to speed up queries etc. Can anybody shed any light on what I'm doing wrong? Thanks, Lezz Giles -- Leslie Giles Software Release Manager Avici Systems Inc [EMAIL PROTECTED] Phone: 978.964.2030 Fax: 978.964.2100 Do not fear the merge - 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