Re: adding values together
You appear to be violating the repeating value rules of relational database. Multivalue databases (Pick and Pick like) support this concept but they are rather uncommon now. You probably need to create a related table. Actually, you might want to do a little study on the general idea of relational databases. Not meaning to be negative here because nobody is born with the knowledge. BobJ Mentioning MySQL to avoid being filtered. - Original Message - From: Steve Mansfield [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, November 28, 2002 7:48 AM Subject: adding values together Hi, doeas anyone know if it's possible to add 2 or more numeric values together that are in the same cell in Mysql: IE: i have a cloumn called price that for any entry may contain more than one value, lets say £1.00 and £2.00 Is there a way that i can get these values added together ? I know it's easy if they are in separate rows but unfortunately they're not. see the example iditemprice 1 apple 1.00 2 apple 1.00 pear2.00 3 banana 1.00 I need to get the sum for price for id 2. Regards, Steve Mansfield Head of Development [EMAIL PROTECTED] http://www.getreal.co.uk Real Data Services Ltd 117-119 Marlborough Road Romford Essex RM7 8AP [Office] 0870 757 7900 [Fax] 0870 757 8900 http://www.be-an-isp.comhttp://www.isdn4free.co.uk http://signup.getreal.co.uk For our email disclaimer please see the url below. http://www.getreal.co.uk/disclaimer.htm - 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: SQL question
I'm new at SQL so I may be off base, but in traditional programming practice when you want that kind of sort (right justified) you would fill the field with preceding zeros and that would cause the sort that you are seeking. I'm sure that you could suppress the zeros on print with some sort of mask. BobJ - Original Message - From: William McCormick [EMAIL PROTECTED] To: John Almberg [EMAIL PROTECTED]; Mysql [EMAIL PROTECTED] Sent: Friday, September 27, 2002 10:08 AM Subject: RE: SQL question I don't know that there is knowing the way sorts usually work I'd say no. This is my first posting to this group and I am just in the initial phases of supporting MySQL as a backend for out application. If the numbers always precede the letters I would split them off into two separate columns and index those columns. The numbers and letters may likely represent something that could be used in your application as separate entities. I may be off base but looks kind of like versioning. Sincerely, Will McCormick -Original Message- From: John Almberg [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 26, 2002 8:05 PM To: Mysql Subject: SQL question I'm trying to sort a table on a character-type field that contains mostly numbers. This field always contains either a number or a number followed by a character. Like '57' or '57a'. I'd like to sort the table *numerically* on this field, not *alphabetically* on this field. That is, I'd like the table to be sorted like: 1 ... 2 ... 2a ... 3 ... 4d ... NOT like: 1 ... 11 ... 111a ... 2a ... 22 ... See what I mean? This is a common problem, I think, when you sort an character type field that contains numbers. The sort comes out all wrong. Is there anyway I can achieve this sort using SQL? The target server is running 3.22.32. Any ideas greatly appreciated! -- John - 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 - 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: load data local infile
Try leaving out the word local. This corrected the same problem on XP Prof. BobJ - Original Message - From: nellA hciR [EMAIL PROTECTED] To: MySQL List [EMAIL PROTECTED] Sent: Thursday, September 12, 2002 2:32 PM Subject: load data local infile i have read several archives/docs on this but still can not get this to work from the mysql command line, load data local infile DOES work, am trying to get this to work from Perl $sth = $dbh-prepare(load data local infile '/users/hcir/desktop/t2/0001' into table s0001); $sth-execute() or warn : $DBI::errstr\n; returns The used command is not allowed with this MySQL version Mac OS X mysql 4.0.3 /etc/my.cnf contains [mysqld] local-infile=1 [mysql] local-infile=1 thanks - hcir - 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