UPDATE and INSERT in one

2007-04-20 Thread lists
Hi, I want to update a table if it meets some conditions (already exist) and INSERT otherwise? Right now I am doing it this way: 1. SELECT the record 2. If it exist, I UPDATE it 3. If it does not exit, I INSERT a new record Could this be done in one query? I mean like conditional

Re: UPDATE and INSERT in one

2007-04-20 Thread Johan Höök
Hi, what you want to look into is (depending on your version) either INSERT ... ON DUPLICATE KEY UPDATE ... or REPLACE http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html http://dev.mysql.com/doc/refman/5.0/en/replace.html /Johan [EMAIL PROTECTED] skrev: Hi, I want to update a

How could write this SQL

2007-04-20 Thread wang shuming
Hi, How could select row1 a1,b1.qty, b2.qty, b3.qty row2 a2,b1.qty, b2.qty, b3.qty row3 a3,b1.qty, b2.qty, b3.qty ... from a table : row1 a1,b1,qty row2 a1,b2,qty row3 a1,b3,qty row4 a2,b1,qty row5 a2,b2,qty row6 a2,b3,qty row7 a3,b1,qty

RE: character_set_xxx

2007-04-20 Thread Edward Kay
How can I change character_set_xxx variables in MySQL 4.1.x in Linux? SET NAMES 'charset' http://dev.mysql.com/doc/refman/4.1/en/charset-connection.html Edward -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL

Re: UPDATE and INSERT in one

2007-04-20 Thread David Precious
[EMAIL PROTECTED] wrote: I want to update a table if it meets some conditions (already exist) and INSERT otherwise? Right now I am doing it this way: 1. SELECT the record 2. If it exist, I UPDATE it 3. If it does not exit, I INSERT a new record Could this be done in one query? I mean like

Re: UPDATE and INSERT in one

2007-04-20 Thread wang shuming
insert into table1 (fa,fb,qty) values (fa1,fb1,qty1) on duplicate key update qty=qty+qty1 a primarykey or unique key must. Shuming Wang

Re: Storing forests in tables.

2007-04-20 Thread Peter Brawley
Nathan, I ve recently been playing with storing trees in mysql using nested set, and I was wondering if anyone knows if this could be extended to forests (set of trees) to be stored in one table? Dead simple, add a treeID smallint column to the table that holds the nested sets, and add ...

ORDER BY multiple columns

2007-04-20 Thread Edward Kay
Hi, I have a query that returns data from a join of two tables, person and company. The results look like: FIRST_NAME | LAST_NAME | COMPANY_NAME - NULL | NULL | Toy Co Mark | Smith | NULL NULL | NULL | Big Corp NULL | NULL

Re: ORDER BY multiple columns

2007-04-20 Thread Baron Schwartz
Hi Edward, Edward Kay wrote: Hi, I have a query that returns data from a join of two tables, person and company. The results look like: FIRST_NAME | LAST_NAME | COMPANY_NAME - NULL | NULL | Toy Co Mark | Smith | NULL NULL | NULL

Looking for people with similar data for exchange of ideas

2007-04-20 Thread Olaf Stein
Hi all, I am hoping to find someone with similar data, who is using mysql to exchange ideas and concepts. A second opinion is always good I guess. I work in a research setup and store mainly trial related, genotypic and phenotypic information. As technology progresses and we are expecting 1M

RE: ORDER BY multiple columns

2007-04-20 Thread Edward Kay
From: Baron Schwartz Hi Edward, Edward Kay wrote: Hi, I have a query that returns data from a join of two tables, person and company. The results look like: FIRST_NAME | LAST_NAME | COMPANY_NAME - NULL | NULL | Toy Co Mark

RE : How could write this SQL

2007-04-20 Thread Jacques Brignon
In case it is acceptable to have a1,b1.qty, b2.qty, b3.qty concatenated in one field GROUP_CONCAT might help http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_ group-concat -- Jacques Brignon -Message d'origine- De : Baron Schwartz [mailto:[EMAIL PROTECTED]

Re: How could write this SQL

2007-04-20 Thread Baron Schwartz
Hi, wang shuming wrote: Hi, How could select row1 a1,b1.qty, b2.qty, b3.qty row2 a2,b1.qty, b2.qty, b3.qty row3 a3,b1.qty, b2.qty, b3.qty ... from a table : row1 a1,b1,qty row2 a1,b2,qty row3 a1,b3,qty row4 a2,b1,qty row5 a2,b2,qty row6

Could someone explain

2007-04-20 Thread Mikhail Berman
Dear List, We are running: mysql status -- mysql Ver 14.12 Distrib 5.0.27, for unknown-freebsd6.0 (i386) using readline 5.0 Could someone explain the meaning or give us brief explanation of the following entries in err file on MySQL server:

Storing forests in tables.

2007-04-20 Thread Nathan Harmston
Hi, I ve recently been playing with storing trees in mysql using nested set, and I was wondering if anyone knows if this could be extended to forests (set of trees) to be stored in one table? Many Thanks in advance, Nathan -- MySQL General Mailing List For list archives:

Re: Trying to open a big sql script

2007-04-20 Thread Joerg Bruehe
Hi! Duncan Hill wrote: On Thursday 19 April 2007 15:53:54 molemenacer wrote: I am trying to change all the names of the database from mthosp to another name, is this possible? Assuming you mean tables, not database (as mysqldump doesn't store the database name in the dump file [or at least

advice for blob tables?

2007-04-20 Thread Michael Higgins
Hello, all -- I want to set up a database for document storage. I've never worked with binary files stored in tables. So before I just jump in and go like I usually do, does anyone have any quick advice, things to consider, links, must-RTFMs or the like to help a newbie out? I feel like I need

Re: Trying to open a big sql script

2007-04-20 Thread Gerald L. Clark
Joerg Bruehe wrote: Hi! Duncan Hill wrote: On Thursday 19 April 2007 15:53:54 molemenacer wrote: I am trying to change all the names of the database from mthosp to another name, is this possible? Assuming you mean tables, not database (as mysqldump doesn't store the database name in

Re: advice for blob tables?

2007-04-20 Thread Dan Buettner
Michael, here's what I can tell you - Some people will advise you against storing documents in tables - claim it makes the data harder to serve up, etc. I agree it's quite simple to set up a folder structure with your files on the filesystem and point Apache or IIS to it while tracking metadata

Re: advice for blob tables?

2007-04-20 Thread colbey
Here's a good php implementation, you can implement the concept in any language you like: http://www.dreamwerx.net/phpforum/?id=1 On Fri, 20 Apr 2007, Michael Higgins wrote: Hello, all -- I want to set up a database for document storage. I've never worked with binary files stored in

Re: advice for blob tables?

2007-04-20 Thread Kevin Waterson
This one time, at band camp, Michael Higgins [EMAIL PROTECTED] wrote: So before I just jump in and go like I usually do, does anyone have any quick advice, things to consider, links, must-RTFMs or the like to help a newbie out? This tutorial deals with images and BLOBs. It should get you