Re: full text search question

2004-09-29 Thread Wesley Furgiuele
Laura: Perhaps the - is acting like a Boolean operator. What if you put double quotes around your search phrase: SELECT * FROM metadata WHERE MATCH( type ) AGAINST ( '+XY-11443' IN BOOLEAN MODE ); Wes On Wed, 29 Sep 2004 13:22:54 -0400, Laura Scott [EMAIL PROTECTED] wrote: Hello, I

Re: Help with PHP to MySQL db connection

2004-09-29 Thread Wesley Furgiuele
This is really just a PHP question, I think. Are MySQL and Apache running on the same machine? What version of MySQL are you running? Typically, you need a PHP mysql_connect() call including the MySQL host, username, and password. You only list the host above. With a default installation of

Re: Get lines matching a select / group by query

2004-09-20 Thread Wesley Furgiuele
Use COUNT(): SELECT COUNT( id ) FROM test WHERE LEFT( id, 5 ) = '12345' GROUP BY value; Wes On Tue, 21 Sep 2004 00:24:33 +0200, Alexander Newald [EMAIL PROTECTED] wrote: Hello, I like to get the number of lines returned by a select ... group by query: Example: SELECT id FROM test

Is there any performance reason to use unique index

2004-09-09 Thread Wesley Furgiuele
Hi: I was wondering if there is any performance-related reason to use a unique index versus a standard index? Is the only benefit of a unique index that it will prevent duplicate values from being inserted into a table unless explicitly allowed? I have a column, colA, that I know contains only

Re: Substring functions in mySQL

2004-09-08 Thread Wesley Furgiuele
Assuming there are no parts of a name that include more than one word (e.g., Mary Jo being someone's first name), an easy way would be to use SUBSTRING_INDEX. First Name = SUBSTRING_INDEX( namefield, ' ', 1 ); Middle Name = SUBSTRING_INDEX( SUBSTRING_INDEX( namefield, ' ', 2 ), ' ', -1 ); Last

Re: load non-fixed formatted text files

2004-09-08 Thread Wesley Furgiuele
Christian: Change your readme and hostname columns to BLOB and use the LOAD_FILE() function to add your record. INSERT INTO test NULL, LOAD_FILE( '/path/to/readme/file' ), LOAD_FILE( '/path/to/hostname/file'); More on the LOAD_FILE() function:

Re: JOIN help

2004-09-08 Thread Wesley Furgiuele
Robb: http://dev.mysql.com/doc/mysql/en/JOIN.html I am assuming all the information you need is student name + city name. SELECT * FROM StudentTable AS s, CityTable AS c WHERE s.CityID = c.CityID Wes On Wed, 8 Sep 2004 19:55:29 -0500, Robb Kerr [EMAIL PROTECTED] wrote: Trying to get my mind

Re: Remote Connecting

2004-09-05 Thread Wesley Furgiuele
It might just be that your connect line isn't working properly. Try this form instead: mysql -u root -h MyLinuxSystem -p You want to connect as user root to host MyLinuxSystem using a password for which you will be prompted. If that doesn't wok, you need to make sure that on your server, on your

Updating a one-to-many with a MIN result from 'many' for each 'one' record?

2004-09-04 Thread Wesley Furgiuele
I have a common update that I need to run that is a bottleneck in a lot of the reports that are being requested. If anybody else has dealt with a similar situation but with more success, any tips would be appreciated. Basically, I have a one-to-many relationship and I want to update every record

Re: Is it possible to have Undeletable Records?

2004-09-04 Thread Wesley Furgiuele
I don't think so. I think your current method of either storing it in the query or with a boolean field is your best bet. What I've seen done in the past is that records get marked with a user level and there is either one or a group of users who are allowed to delete or modify those otherwise

Re: root without permissions...

2004-08-29 Thread Wesley Furgiuele
Jose: It looks like you can log in to the mysql client as root. Do you have permission to change the password once you're logged in? [EMAIL PROTECTED] jusoz]$ mysql -u root -p Enter password: Welcome to the MySQL monitor... mysqlUSE mysql; Database changed. mysqlUPDATE user SET Password =

Re: select rows by compare on datetime column

2004-08-18 Thread Wesley Furgiuele
Does the date matter, or only the time? If date matters (you want to find all records between 2004-06-01 10:00:00 AND 2004-06-03 18:00:00): SELECT columns FROM table WHERE start_time = '2004-06-01 10:00:00' AND end_time = '2004-06-03 18:00:00' If only time matters( you want to find all records

Re: select rows by compare on datetime column

2004-08-18 Thread Wesley Furgiuele
:24 PM, Wesley Furgiuele wrote: Does the date matter, or only the time? If date matters (you want to find all records between 2004-06-01 10:00:00 AND 2004-06-03 18:00:00): SELECT columns FROM table WHERE start_time = '2004-06-01 10:00:00' AND end_time = '2004-06-03 18:00:00' If only time matters

Re: select rows by compare on datetime column - more on time decrement

2004-08-18 Thread Wesley Furgiuele
. Please let me know? -Original Message- From: Wesley Furgiuele [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 18, 2004 11:36 AM To: Viswanatha Rao Cc: [EMAIL PROTECTED] List Subject: Re: select rows by compare on datetime column Vishwa: Sorry -- I used a specific time value as an example

Re: Can connect with PHP to MYSQL

2004-08-13 Thread Wesley Furgiuele
What error are you getting? My problem when moving to 4.1 was forgetting that I was using an older MySQL client. I'm not positive, but I think that in order to connect to MySQL 4.1 with PHP you need to use the mysqli functions, not mysql, and mysqli requires PHP 5. If you want to keep

Re: BLOB columns

2004-08-05 Thread Wesley Furgiuele
I tend to use LOAD_FILE(), but your file has to be on the server and readable by MySQL (INSERT INTO table ( field1, field2 ) VALUES ( 'a', LOAD_FILE( 'filepath' ) ). If you're using a programming language rather than just the MySQL client, you can also read the file into a variable and insert

Re: Login question

2004-07-30 Thread Wesley Furgiuele
Try SET PASSWORD FOR 'root'@'localhost' = PASSWORD( 'newpwd' ); SET PASSWORD FOR 'root'@'%' = PASSWORD( 'newpwd' ); There was no username in your SET PASSWORD command. Wes On Jul 30, 2004, at 4:38 PM, aspsa wrote: Per the MySQL documentation I used the following commands to establish login both

Re: 4.0.17 to 4.1.3 connection problem

2004-07-28 Thread Wesley Furgiuele
Keith: I don't know if it's the same problem, but I recently had issues where I had a similar setup with only two MySQL servers, one 4.0.20, the other 4.1.3, same usernames/passwords on each. My solution, and I don't remember where in the manual I saw this (possibly the FAQ), was to do an

query to select only numeric portion of string

2004-07-25 Thread Wesley Furgiuele
Using MySQL 4.0.20, I need to extract just the numeric portion of a string in a field and move it to another field in the same table, but I'd only like to do this if the value actually starts with a number. So, what I'm looking to accomplish is: UPDATE table SET field2 = VOODOO( field1 ) The

Re: FULLTEXT search

2004-07-22 Thread Wesley Furgiuele
OR From the manual: Every correct word in the collection and in the query is weighted according to its significance in the collection or query. http://dev.mysql.com/doc/mysql/en/Fulltext_Search.html If you want AND, look at the boolean full-text searches format:

Re: str_to_date problem

2004-07-22 Thread Wesley Furgiuele
Danny: What if you just pad the string, does it work then? str_to_date( LPAD( '901', 4, '0' ), '%k%i' ) Wes On Jul 22, 2004, at 2:05 PM, [EMAIL PROTECTED] wrote: I have a time field formatted as hhmm however the hours field does not add leading zeros. eg 09:01 is simple 901. I want to get a

Re: Removing a specific set of duplicates

2004-07-20 Thread Wesley Furgiuele
Scott: Rather than make the email address column unique, since you want to allow multiple email address instances, you can make a unique index based on email_address+group. Wouldn't that help, or is that still too simple for your situation? Regarding temporary tables, from the MySQL manual:

Re: Removing a specific set of duplicates

2004-07-20 Thread Wesley Furgiuele
Scott: Sorry, should have included it... http://dev.mysql.com/doc/mysql/en/CREATE_INDEX.html The basic syntax you're looking to use is ALTER TABLE tablename ADD UNIQUE `index_name` ( email_address, group ) Wes On Jul 20, 2004, at 7:45 PM, Scott Haneda wrote: on 7/20/04 4:10 PM, Wesley Furgiuele

Re: Removing a specific set of duplicates

2004-07-20 Thread Wesley Furgiuele
, Scott Haneda wrote: on 7/20/04 4:10 PM, Wesley Furgiuele at [EMAIL PROTECTED] wrote: Rather than make the email address column unique, since you want to allow multiple email address instances, you can make a unique index based on email_address+group. Wouldn't that help, or is that still too simple

Re: Need help with a select. Regex?

2004-07-20 Thread Wesley Furgiuele
To get http://www.google.com/; out of the URL, you can do this: LEFT( referer, LENGTH( SUBSTRING_INDEX( referer, '/', 3 ) ) + 1 ) If you don't care about the trailing slash, you can use just the SUBSTRING_INDEX() portion: SUBSTRING_INDEX( referer, '/', 3 ) Using the LENGTH() function just helps

Re: Removing a specific set of duplicates

2004-07-20 Thread Wesley Furgiuele
need to document that there was an attempt to insert the data. Wes On Jul 21, 2004, at 12:58 AM, Scott Haneda wrote: on 7/20/04 9:44 PM, Wesley Furgiuele at [EMAIL PROTECTED] wrote: First off, the unique index is something you define for the table once. Being unique, you won't be allowed to add

Re: Need help with a select. Regex?

2004-07-20 Thread Wesley Furgiuele
string. Sorry for any confusion. Wes On Jul 21, 2004, at 1:01 AM, Wesley Furgiuele wrote: To get http://www.google.com/; out of the URL, you can do this: LEFT( referer, LENGTH( SUBSTRING_INDEX( referer, '/', 3 ) ) + 1 ) If you don't care about the trailing slash, you can use just the SUBSTRING_INDEX

Re: Creating a Composite Index

2004-07-18 Thread Wesley Furgiuele
David: I believe you mentioned it in a previous thread, but I forget what kind of field NameMam is. It's important because you might be required to give that key part in your index a length. Also, I'm assuming that this index is on a unique identifier field. If it's not, then just substitute

Re: Displaying Values With Commas.

2004-07-17 Thread Wesley Furgiuele
Someone else might be able to provide a SQL query for formatting with commas, but otherwise just let PHP do all your formatting. PHP's number_format() function is probably your best bet. You might want to look at PHP's money_format() function also, since it might save you some time depending

Re: deleting duplicates from table

2004-07-16 Thread Wesley Furgiuele
I think one way to solve it would be to move your data to a new copy of your table. Assuming record_ref and keyword are separate fields... CREATE TABLE newtable SELECT * FROM oldtable GROUP BY CONCAT( record_ref, keyword ); Wes On Jul 16, 2004, at 7:08 PM, L a n a wrote: Hello, I'm trying to

Re: sql function for timestamp

2004-07-14 Thread Wesley Furgiuele
If you have 4.1.1 or greater, you can use GET_FORMAT( timestamp, 'ISO' ). Otherwise, I think if you just use DATE_FORMAT( timestamp, '%Y-%m-%d %H:%i ) you will get weird values if your timestamp field doesn't include seconds. So, either alter your field to be CONCAT( timestamp, '00' ), or, as

Re: sql function for timestamp

2004-07-14 Thread Wesley Furgiuele
JS: When I use DATE_FORMAT(), if I have a space character between DATE_FORMAT and the ( I get an error. Try writing it like: SELECT DATE_FORMAT( 20040601123456, '%Y-%m-%d' ); MySQL v4.1.2-alpha-standard Mac OS X Wes On Jul 14, 2004, at 12:20 PM, J S wrote: Thanks for your help. I would like to

Re: all upper case records.. Keeping first char upper and rest lower?

2004-07-13 Thread Wesley Furgiuele
SELECT CONCAT( UPPER( LEFT( first, 1 ) ), LOWER( RIGHT( first, LENGTH( first ) - 1 ) ) ) AS `first` FROM table On Jul 13, 2004, at 12:51 PM, Aaron Wolski wrote: Hey guys, I have a column in a table called 'first'. Currently all records are upper case. Is it possible for me to do a select

Re: Why this query doesn't group the email addresses?

2004-07-13 Thread Wesley Furgiuele
What type of field is the email field? Wes On Jul 13, 2004, at 11:04 AM, Aaron Wolski wrote: Hey all, Got this query: SELECT first,last,email FROM CustomerTable AS t1, OrderTable AS t2, CartTable AS t3 WHERE t2.cart_id=t3.cart_id AND t1.id=t2.customer_index AND t3.submitted='1' AND

Re: Why this query doesn't group the email addresses?

2004-07-13 Thread Wesley Furgiuele
[EMAIL PROTECTED] --DUPE-- Case differences between the records could also cause dupes. If case differences are causing it then do select lower(first), lower(last), lower(email) ... group by lower(first), lower(last), lower(email) --- Wesley Furgiuele [EMAIL PROTECTED] wrote: What type of field

Re: basic select question...

2004-07-05 Thread Wesley Furgiuele
Possibly because, if there is no typo, your table's name field is: dr. smith1 (note the period after dr) But your query is looking for dr smith1 Does that fix it for you? Wes On Jul 5, 2004, at 4:18 PM, bruce wrote: hi... a basic select question/issue that should work mysql select * from

Re: converting timestamps to US Date format

2004-07-05 Thread Wesley Furgiuele
Gary: Am I looking at PHP's date() function? You are taking a timestamp from a MySQL table and wanting to convert it into a US format. Is the timestamp stored in your MySQL table a Unix timestamp or a MySQL timestamp? It's important to note that you can't take a MySQL timestamp and use PHP's

Re: basic question about joins....

2004-07-04 Thread Wesley Furgiuele
Bruce: The problem is that you have universityTBL listed twice in your list of tables. Here is your statement, with numbers for each of the sources. SELECT schoolTBL.name, universityTBL.name FROM (1) universityTBL, (2) schoolTBL LEFT JOIN (3) universityTBL ON schoolTBL.universityID =

Re: How to install MySQL

2004-07-03 Thread Wesley Furgiuele
After you finish installing MySQL, you need to start it up before connecting to it -- the installation won't do that automatically for you. http://dev.mysql.com/doc/mysql/en/Unix_post-installation.html That manual page will give you the right commands. Basically, after installation, run the

Re: making lower case then first char to upper case?

2004-06-30 Thread Wesley Furgiuele
Someone else hopefully has something more efficient: UPDATE table SET field = CONCAT( UPPER( LEFT( field, 1 ) ), LOWER( SUBSTRING( field, 2 ) ) ) Wes On Jun 30, 2004, at 12:46 PM, Aaron Wolski wrote: Hi Guys, I'm trying to figure out of this is possible. I know I could do it in PHP but I am

Re: return substrings out of a string

2004-06-30 Thread Wesley Furgiuele
Lana: The easiest thing would be if your field always contained the same number of comma-separated strings. Then you could just do something like a SUBSTRING_INDEX() function to break out the field into separate values. But, assuming your field does not always contain the same number of

Re: Auto Date selection and format

2004-06-30 Thread Wesley Furgiuele
I can help easily enough on formatting the dates... The DATE_FORMAT( date, format ) function is what you want: DATE_FORMAT( date, %m/%d/%Y ) Wes On Jun 30, 2004, at 9:40 PM, Mike Koponick wrote: Hello all, I would like to be able to select the certain dates within my script. select created_date,

Re: Migrating Access Tables -- Empty Columns, Date and Time

2004-06-29 Thread Wesley Furgiuele
Bob My versions are Access 2000 and MySQL 4.0.20. Here's what I do. When exporting my Access table, I choose the file type Text Files. Then, on the next dialog box, make sure to click the Advanced button to get to the formatting information. Change the date order to YMD and the date delimiter

Re: Using REGEXP

2004-06-29 Thread Wesley Furgiuele
zzapper: I could be reading it wrong, but it looks like you're looking for the result of your REGEXP in a list. REGEXP returns only a 0 or 1, not the expression resulting from performing a REGEXP. Wes On Jun 29, 2004, at 9:25 AM, zzapper wrote: Hi, select * from ytbl_development as t1 where

Re: Displaying Numerals Dates

2004-06-26 Thread Wesley Furgiuele
David: For number formatting, in your below example, use: ?php foreach( $data as $r ) { print number_format( $r['Numerals'] ); } ? http://us2.php.net/manual/en/function.number-format.php For date formatting, try grabbing the date from MySQL in the format you want to use: SELECT

Re: Displaying Numerals Dates

2004-06-26 Thread Wesley Furgiuele
, David Blomstrom wrote: --- Wesley Furgiuele [EMAIL PROTECTED] wrote: Otherwise, you could use PHP's date formatting functions as well (assuming you are getting the date in -MM-DD format: ?php foreach( $data as $r { list( $year, $month, $day ) = explode( -, $r['Dates

CAST( string AS UNSIGNED ) question about reliability

2004-06-20 Thread Wesley Furgiuele
Does anybody have any feedback, particularly problems, using CAST to strip the trailing alpha characters from a string in order to convert the string to an integer? Is there a better way to do it with MySQL? (MySQL 4.0.20, Mac OS X 10.3) Here's my situation: TABLE_1 id CHAR( 8 ) TABLE_2 id

More appropriate way to join tables?

2002-05-06 Thread Wesley Furgiuele
I am guessing this is a pretty basic question... There must be a better way for me to do this, but I'm still too new at this to know what it is. I've gone through some JOIN tutorials and the documentation, but I don't think I'm quite getting it. (Using MySQL v3.23.38) I have three tables: