Re: upgraded from 5.1-5.5. now getting a mysqldump ERROR 1142: SELECT,LOCK TABL command denied to user 'root'@'localhost' for table 'cond_instances' when using LOCK TABLES. a bug or my config?

2011-06-05 Thread Reindl Harald
Am 05.06.2011 23:55, schrieb ag...@airpost.net: i still have no idea why this is necessary. take it or not it is a professional solution which works for databses with 20 GB every day here with rsync without interrupt/lock mysqld a second and it is much faster there seems to be a but,

Re: Select with counts of matching rows from another table...

2011-03-31 Thread S�ndor Hal�sz
2011/03/23 16:29 -0700, Steffan A. Cline So, this is what I have as a basis to work on assuming I am polling article #36. Select *, if(b.articleid=36,1,0) as checked from groups g Left join agmap a on g.groupid=a.groupid Left join articles b on a.articleid=b.articleid Order by g.groupname Why

Re: Select with counts of matching rows from another table...

2011-03-31 Thread Reindl Harald
Am 31.03.2011 17:53, schrieb S?ndor Hal?sz: 2011/03/23 16:29 -0700, Steffan A. Cline So, this is what I have as a basis to work on assuming I am polling article #36. Select *, if(b.articleid=36,1,0) as checked from groups g Left join agmap a on g.groupid=a.groupid Left join articles b

Select with counts of matching rows from another table...

2011-03-23 Thread Steffan A. Cline
to pull the groups into a list of checkboxes and check them accordingly upon edit. So, this is what I have as a basis to work on assuming I am polling article #36. Select *, if(b.articleid=36,1,0) as checked from groups g Left join agmap a on g.groupid=a.groupid Left join articles b on a.articleid

Re: Unexpected Select Output

2011-03-15 Thread Johan De Meersman
- From: Adarsh Sharma adarsh.sha...@orkash.com To: mysql@lists.mysql.com Sent: Tuesday, 15 March, 2011 5:56:17 AM Subject: Unexpected Select Output Dear all, Today I shoot a query to know the size of tables in a particular database, but don't know why it prints only the output of only one table

Re: Unexpected Select Output

2011-03-15 Thread Johan De Meersman
- Original Message - From: Adarsh Sharma adarsh.sha...@orkash.com I am able to fetch the output individually, but I try that I access all information through one command : mysql SELECT table_schema 'database',table_name 'Table', concat( round( sum( data_length + index_length

Script to mail output of select query

2011-03-15 Thread Adarsh Sharma
Dear all, I have prepared a simple script that shows the database, tables size in the Database server as :- Please check the attachment for the script output. Now I just want to mail the output of my script to some persons e-mail-ID Also, I want to do some calculations and provide the

Re: Script to mail output of select query

2011-03-15 Thread Johan De Meersman
- Original Message - From: Adarsh Sharma adarsh.sha...@orkash.com Please check the attachment for the script output. Thanks for your password :-) Now I just want to mail the output of my script to some persons e-mail-ID Assuming you run this from crontab, just set

Unexpected Select Output

2011-03-14 Thread Adarsh Sharma
Dear all, Today I shoot a query to know the size of tables in a particular database, but don't know why it prints only the output of only one table. Here is my query output : mysql SELECT table_schema 'database',table_name 'Table', concat( round( sum( data_length + index_length ) / ( 1024

Why do stored procedures limited to Select stmt to 1 OUT parameter?

2011-02-28 Thread mos
statements to get all of the results. That to me is incredibly inefficient. Is there any way to avoid this? I'd like to be able to do this (only 3 OUT parameters in this example): CREATE PROCEDURE productpricing( OUT pl DECIMAL(8,2), OUT ph DECIMAL(8,2), OUT pa DECIMAL(8,2) ) BEGIN SELECT

Re: Why do stored procedures limited to Select stmt to 1 OUT parameter?

2011-02-28 Thread Michael Dykman
One statement will do: SELECT Min(prod_price) , Max(prod_price), Avg(prod_price) INTO pl, ph, pa from products; - michael dykman On Mon, Feb 28, 2011 at 4:30 PM, mos mo...@fastmail.fm wrote: I want to have a stored procedure that returns 5 columns from a table and do some calculations

Re: Why do stored procedures limited to Select stmt to 1 OUT parameter?

2011-02-28 Thread mos
At 03:36 PM 2/28/2011, Michael Dykman wrote: One statement will do: SELECT Min(prod_price) , Max(prod_price), Avg(prod_price) INTO pl, ph, pa from products; - michael dykman Michael, Brilliant! Thanks. :-) Mike On Mon, Feb 28, 2011 at 4:30 PM, mos mo...@fastmail.fm wrote: I

MySQL Proxy - Select Proxy On Auth

2011-02-10 Thread Randy Wilson
Hi, I have a situation where I need clients to connect to a proxy server and to then determine which MySQL server to forward their connection to based on the username supplied. Does anyone know if this is possible using mysql-proxy with Lua? Or by any other means? Thanks. REW

Re: SELECT Help

2011-02-04 Thread Tompkins Neil
...@hotmail.com wrote: Something like this might help you find all of the times where your user_id switched to a different team_id: select team_id, user_id, min(last_changed) from (select home_team_id as team_id, home_user_id as user_id, last_changed from data union all select away_team_id

Table/select problem...

2011-02-04 Thread Andy Wallace
Greetings, all... I'm having an issue with a SELECT in our system. We have an event log table, with about 9 million rows in it. Inserts happen with some pretty high frequency, and these selects happen periodically. The event_log table is MyISAM, the rest of the tables are InnoDB. What's

Re: Table/select problem...

2011-02-04 Thread Steve Musumeche
I had this same issue a while back and solved it by writing my events to a disk-based file and periodically importing them into the event log MyISAM table. This way, even if your select statements lock the table, it won't affect the performance of your application. Of course, this may

Re: Table/select problem...

2011-02-04 Thread Johan De Meersman
Do you delete data from the table ? MyISAM will only grant a write lock when there are no locks on the table - including implicit read locks. That may be your problem. There is a single situation when concurrent reads and writes are possible on MyISAM, however: when your table has no holes in

RE: Table/select problem...

2011-02-04 Thread Travis Ard
What columns do you have indexed on your event_log table? Can you post the output from SHOW CREATE TABLE? How long does the query run for? -Original Message- From: Andy Wallace [mailto:awall...@ihouseweb.com] Sent: Friday, February 04, 2011 10:29 AM To: mysql list Subject: Table/select

SELECT Help

2011-02-03 Thread Tompkins Neil
Hi, I've the following list of sample data, and need a SELECT statement to help me identify the point at which I've highlighted the data : Season, Competition, home_team_id, away_team_id, home_user_id, away_user_id, last_changed 1, 18, 11, 23, 3, 2010-11-14 17:18:17 1, 11, 8, 3, 82, 2010-11-14

RE: SELECT Help

2011-02-03 Thread Travis Ard
Something like this might help you find all of the times where your user_id switched to a different team_id: select team_id, user_id, min(last_changed) from (select home_team_id as team_id, home_user_id as user_id, last_changed from data union all select away_team_id as team_id, away_user_id

RE: export result from select statement

2011-01-10 Thread Jerry Schwartz
-Original Message- From: LAMP [mailto:l...@afan.net] Sent: Sunday, January 09, 2011 9:46 PM To: mysql@lists.mysql.com Subject: Re: export result from select statement maybe it's clear to other but it's pretty unclear. #mysql -username -p select * from table_name where id=123 '/home/me

RE: export result from select statement

2011-01-10 Thread Jerry Schwartz
-Original Message- From: Michael Dykman [mailto:mdyk...@gmail.com] Sent: Sunday, January 09, 2011 3:02 PM To: LAMP; mysql@lists.mysql.com Subject: Re: export result from select statement I second Jerry's recommendation. It always works like a charm for me. [JS] Thanks. By the way

RE: export result from select statement

2011-01-09 Thread Jerry Schwartz
: 860.674.8341 E-mail: je...@gii.co.jp Web site: www.the-infoshop.com -Original Message- From: LAMP [mailto:l...@afan.net] Sent: Saturday, January 08, 2011 6:05 PM To: mysql@lists.mysql.com Subject: export result from select statement Hi guys, I wonder how to store to csv or txt file result from

Re: export result from select statement

2011-01-09 Thread Michael Dykman
: Saturday, January 08, 2011 6:05 PM To: mysql@lists.mysql.com Subject: export result from select statement Hi guys, I wonder how to store to csv or txt file result from SELECT query? not a whole table nor database. Just results from SELECT query. Usually I use MySQL Query Browser and Export feature

Re: export result from select statement

2011-01-09 Thread LAMP
Eric Bergen wrote: select into outfile is the correct way. What do you mean by doesn't work? Does it give you an error? It was an issue with permissions :-) Thanks On Sat, Jan 8, 2011 at 3:04 PM, LAMP l...@afan.net wrote: Hi guys, I wonder how to store to csv or txt file result from

Re: export result from select statement

2011-01-09 Thread LAMP
maybe it's clear to other but it's pretty unclear. #mysql -username -p select * from table_name where id=123 '/home/me/test/test.txt' actually doesn't work?!? Jerry Schwartz wrote: The technique I've settled on is this: mysql blah blah blah the_select_query.sql the_output_i_want.txt

Re: export result from select statement

2011-01-09 Thread Yogesh Kore
#mysql -username -p -e select * from table_name where id=123 '/home/me/test/test.txt' On Mon, Jan 10, 2011 at 8:15 AM, LAMP l...@afan.net wrote: maybe it's clear to other but it's pretty unclear. #mysql -username -p select * from table_name where id=123 '/home/me/test/test.txt' actually

export result from select statement

2011-01-08 Thread LAMP
Hi guys, I wonder how to store to csv or txt file result from SELECT query? not a whole table nor database. Just results from SELECT query. Usually I use MySQL Query Browser and Export feature, but in this case I don't have access with MySQL Query Browser. Though, I have a command line

Re: export result from select statement

2011-01-08 Thread Eric Bergen
select into outfile is the correct way. What do you mean by doesn't work? Does it give you an error? On Sat, Jan 8, 2011 at 3:04 PM, LAMP l...@afan.net wrote: Hi guys, I wonder how to store to csv or txt file result from SELECT query? not a whole table nor database. Just results from SELECT

Select from the table being updated

2010-12-29 Thread Yves Goergen
Hi, why doesn't MySQL support selecting from the table being updated? The following and any variations of it doesn't work: UPDATE t1 (c1) VALUES (SELECT MAX(c1) FROM t1); This restriction is documented here: http://dev.mysql.com/doc/refman/5.5/en/update.html (at the very bottom) Wouldn't

Re: odd problem with select as statement

2010-12-20 Thread Johnny Withers
I can't tell you 'why' it is occurring when the field name begins with 4E5, but you can solve your problem by enclosing all your field names in backticks ( ` ). IE: SELECT field AS `4E5664736F400E8B482EA7AA67853D13` On Mon, Dec 20, 2010 at 11:43 AM, Ramsey, Robert L robert-ram

Re: odd problem with select as statement

2010-12-20 Thread Hank
getting a select as statement right. Here is the full query: select SUM(IF(image='EE0840D00E2ED8A317E5FA9899C48C19',1,0)) as EE0840D00E2ED8A317E5FA9899C48C19, SUM(IF(image='235C7987796D5B7CEBF56FBDA2BF7815',1,0)) as 235C7987796D5B7CEBF56FBDA2BF7815, SUM(IF(image='96DC0562ED6E6F7FE789A18E09BC5889

Re: odd problem with select as statement

2010-12-20 Thread Hank
i.e. just try this: mysql select 4E5664736F400E8B482EA7AA67853D13; ERROR 1367 (22007): Illegal double '4E5664736' value found during parsing -Hank On Mon, Dec 20, 2010 at 12:50 PM, Hank hes...@gmail.com wrote: Here's my 5 second guess.. 4E5664736... is being interpreted as a number

RE: odd problem with select as statement

2010-12-20 Thread Ramsey, Robert L
Yes! The illegal double error only happens if you do the select like you did. The only error I was getting was the generic there's an error in your sql. Thank you! Bob From: Hank [mailto:hes...@gmail.com] Sent: Monday, December 20, 2010 11:52 AM To: Ramsey, Robert L Cc: mysql

Re: select data from two tables and SUM qty of the same ID

2010-11-10 Thread haidarpesebe
Thanks a lot. We will try and inform you. --Original Message-- From: Aveek Misra To: Albahar Uya Cc: MySQL Lists Subject: Re: select data from two tables and SUM qty of the same ID Sent: Nov 10, 2010 17:38 SELECT product.ID, product.ProductName, product.ISBN, SUM(salesreport.QTY

Re: select data from two tables and SUM qty of the same ID

2010-11-10 Thread Aveek Misra
SELECT product.ID, product.ProductName, product.ISBN, SUM(salesreport.QTY) as Total_Quantity FROM salesreport, product WHERE product.ID = salesreport.ID GROUP BY salesreport.ID ORDER BY Total_Quantity DESC; On Nov 10, 2010, at 3:53 PM, HaidarPesebe wrote: please help us look for the data

select data from two tables and SUM qty of the same ID

2010-11-10 Thread HaidarPesebe
please help us look for the data select from two tables with the following details: Primary table: product ID | ProductName | ISBN | --- 1 | Product A | 123 | 2 | Product B | 456 | 3 | product C | 444 | --- second table

Re: select data from two tables and SUM qty of the same ID

2010-11-10 Thread HaidarPesebe
we've tried to use as your dialing purposes, but still can not. This structure SELECT product.product_id, product.isbn, product.name, product.author, product.harga, product.discount, sum(sales_report.qty) as totalqty FROM . $prefix . _sales_report, . $prefix . _product WHERE

Re: select data from two tables and SUM qty of the same ID

2010-11-10 Thread HaidarPesebe
I tried this and succeeded. Thank you SELECT product_id, isbn, name, author, harga, discount, sum(qty) as totalqty FROM . $prefix . _sales_report b INNER JOIN . $prefix . _product p ON (p.product_id = b.bid) GROUP BY b.bid ORDER BY totalqty DESC haidarpesebe - Original Message - From

Re: How do I GRANT SELECT to mysql.time_zone_name for ANYONE?!

2010-10-15 Thread Johnny Withers
I think this is one of those times you would update the mysql.user table directly, then flush privileges. JW On Thu, Oct 14, 2010 at 6:46 PM, Daevid Vincent dae...@daevid.com wrote: I'm pulling my hair out. How do I GRANT the SELECT ability to ANY USER for the very specific

Re: How do I GRANT SELECT to mysql.time_zone_name for ANYONE?!

2010-10-15 Thread Suresh Kuna
directly, then flush privileges. JW On Thu, Oct 14, 2010 at 6:46 PM, Daevid Vincent dae...@daevid.com wrote: I'm pulling my hair out. How do I GRANT the SELECT ability to ANY USER for the very specific mysql.time_zone_name table?? I don't want to GRANT it to every individual user manually

Re: How do I GRANT SELECT to mysql.time_zone_name for ANYONE?!

2010-10-15 Thread Jesper Wisborg Krogh
, then flush privileges. You can grant access to the time zone tables just as you would do to any other table. GRANT SELECT ON `mysql`.`time_zone_name` TO '%'; GRANT SELECT ON `mysql`.`time_zone_name` TO '%'@'%'; GRANT SELECT ON `mysql`.`time_zone_name` TO ''@'%'; GRANT SELECT ON `mysql

RE: How do I GRANT SELECT to mysql.time_zone_name for ANYONE?!

2010-10-15 Thread Daevid Vincent
-Original Message- From: Jesper Wisborg Krogh [mailto:jes...@noggin.com.au] Sent: Friday, October 15, 2010 2:33 PM To: MY SQL Mailing list Subject: Re: How do I GRANT SELECT to mysql.time_zone_name for ANYONE?! Hi On 16/10/2010, at 1:47 AM, Suresh Kuna wrote: Hey Daevid

Re: How do I GRANT SELECT to mysql.time_zone_name for ANYONE?!

2010-10-15 Thread Jesper Wisborg Krogh
grant that automatically will apply to all users. So if you have three users use...@localhost, use...@192.168.1.1, and use...@localhost you have to run: GRANT SELECT ON `mysql`.`time_zone_name` TO 'user_a'@localhost; GRANT SELECT ON `mysql`.`time_zone_name` TO 'user_a'@192.168.1.1; GRANT SELECT

RE: How do I GRANT SELECT to mysql.time_zone_name for ANYONE?!

2010-10-15 Thread Daevid Vincent
-Original Message- From: Jesper Wisborg Krogh [mailto:jes...@noggin.com.au] Sent: Friday, October 15, 2010 5:54 PM To: MY SQL Mailing list Subject: Re: How do I GRANT SELECT to mysql.time_zone_name for ANYONE?! Any user can get into mysql, it's what they can do after that's

How do I GRANT SELECT to mysql.time_zone_name for ANYONE?!

2010-10-14 Thread Daevid Vincent
I'm pulling my hair out. How do I GRANT the SELECT ability to ANY USER for the very specific mysql.time_zone_name table?? I don't want to GRANT it to every individual user manually, I want one single GRANT that encompasses every user simultaneously. I've tried all of these, and they all are valid

Select NICE

2010-09-29 Thread Steve Staples
Google has not been kind to me on this one, so I figured I would ask here... how can I select with NICE options, so that it doesn't KILL my server, or any other queries... Do you understand what I am asking? Steve -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql

Re: Select NICE

2010-09-29 Thread mos
At 10:49 AM 9/29/2010, Steve Staples wrote: Google has not been kind to me on this one, so I figured I would ask here... how can I select with NICE options, so that it doesn't KILL my server, or any other queries... Do you understand what I am asking? Steve Steve, You might look at http

SELECT WHERE IN help

2010-09-21 Thread Tompkins Neil
Hi With a SELECT * FROM my_table WHERE record_id IN (3,4,5,6,7,3), how can I return two records for the record_id 3 ? Is it possible ? Cheers Neil

Re: SELECT WHERE IN help

2010-09-21 Thread Johan De Meersman
If there are two, you will return two. On Tue, Sep 21, 2010 at 5:33 PM, Tompkins Neil neil.tompk...@googlemail.com wrote: Hi With a SELECT * FROM my_table WHERE record_id IN (3,4,5,6,7,3), how can I return two records for the record_id 3 ? Is it possible ? Cheers Neil -- Bier met

Re: SELECT WHERE IN help

2010-09-21 Thread Tompkins Neil
Meersman vegiv...@tuxera.bewrote: If there are two, you will return two. On Tue, Sep 21, 2010 at 5:33 PM, Tompkins Neil neil.tompk...@googlemail.com wrote: Hi With a SELECT * FROM my_table WHERE record_id IN (3,4,5,6,7,3), how can I return two records for the record_id 3 ? Is it possible

Re: SELECT WHERE IN help

2010-09-21 Thread Johan De Meersman
two. On Tue, Sep 21, 2010 at 5:33 PM, Tompkins Neil neil.tompk...@googlemail.com wrote: Hi With a SELECT * FROM my_table WHERE record_id IN (3,4,5,6,7,3), how can I return two records for the record_id 3 ? Is it possible ? Cheers Neil -- Bier met grenadyn Is als mosterd by den

Re: SELECT WHERE IN help

2010-09-21 Thread Tompkins Neil
...@googlemail.com wrote: Hi With a SELECT * FROM my_table WHERE record_id IN (3,4,5,6,7,3), how can I return two records for the record_id 3 ? Is it possible ? Cheers Neil -- Bier met grenadyn Is als mosterd by den wyn Sy die't drinkt, is eene kwezel Hy die't drinkt, is ras een ezel

Re: SELECT WHERE IN help

2010-09-21 Thread Mark Goodge
On 21/09/2010 16:44, Tompkins Neil wrote: Thanks for the quick reply. Basically in (3,4,5,6,7,3) the record_id of 3 only exists once in the table my_table. However, because 3 exists twice within (3,4,5,6,7,3), I want it to return two records for record_id 3. Is it possible ? No, that isn't

Re: SELECT WHERE IN help

2010-09-21 Thread Joerg Bruehe
Hi Neil, all! Tompkins Neil wrote: Hi With a SELECT * FROM my_table WHERE record_id IN (3,4,5,6,7,3), how can I return two records for the record_id 3 ? Is it possible ? This is a case where you may safely use natural language and logic. The command is SELECT all fields FROM

RE: SELECT WHERE IN help

2010-09-21 Thread Jerry Schwartz
-Original Message- From: Tompkins Neil [mailto:neil.tompk...@googlemail.com] Sent: Tuesday, September 21, 2010 11:48 AM To: Johan De Meersman Cc: [MySQL] Subject: Re: SELECT WHERE IN help Thanks for the reply. The search of (3,4,5,6,7,3) is pulling data from a table. I think

Re: Complex Select Query

2010-08-25 Thread Ashish Mukherjee
@lists.mysql.com Subject: Complex Select Query Hi; I have the following query: select * from spreadsheets s join products p on p.Item=s.Item join categories c on p.Category=c.ID where s.Client=%s order by p.category, c.parent; mysql describe products

Complex Select Query

2010-08-24 Thread Victor Subervi
Hi; I have the following query: select * from spreadsheets s join products p on p.Item=s.Item join categories c on p.Category=c.ID where s.Client=%s order by p.category, c.parent; mysql describe products; +-+--+--+-+-++ | Field | Type

Re: Complex Select Query

2010-08-24 Thread Peter Brawley
://www.artfulsoftware.com/mysqlbook/sampler/mysqled1ch20.html and http://www.artfulsoftware.com/infotree/treequeryperformance.pdf. PB - -Original Message- From: Victor Subervi victorsube...@gmail.com Sent: Aug 24, 2010 1:14 PM To: mysql@lists.mysql.com Subject: Complex Select Query

Re: Complex Select Query

2010-08-24 Thread Victor Subervi
: Victor Subervi victorsube...@gmail.com Sent: Aug 24, 2010 1:14 PM To: mysql@lists.mysql.com Subject: Complex Select Query Hi; I have the following query: select * from spreadsheets s join products p on p.Item=s.Item join categories c on p.Category=c.ID where s.Client=%s order by p.category

Re: MySQL select matching

2010-07-22 Thread Roberto Zárate Mendoza
hello ash...@pcraft.com; where is the solution: You have table A, so copy the entire table in another table. Table B. so Table A=Table B (only in data no constrains) then [id]=id you want to search Untitled select B.cod,count(*) entrysA from A,B where A.atrib1=B.atrib1 and A.atrib2=B.atrib2

Re: [PHP] MySQL select matching

2010-07-21 Thread Simcha Younger
On Mon, 19 Jul 2010 10:36:40 -0600 Ashley M. Kirchner ash...@pcraft.com wrote: mysql select * from table where id='1'; +---+-+-+---+ | 1 | 123 | 0.0 | C | | 1 | 234 | 0.1 | D | | 1 | 345 | 0.0 | D | | 1 | 456 | 0.1 | C | | 1 | 567 | 0.1 | G

MySQL select matching

2010-07-19 Thread Ashley M. Kirchner
| | 4 | 123 | 0.0 | C | | 4 | 234 | 0.1 | D | | 4 | 345 | 0.0 | D | +---+-+-+---+ mysql select * from table where id='1'; +---+-+-+---+ | 1 | 123 | 0.0 | C | | 1 | 234 | 0.1 | D | | 1 | 345 | 0.0 | D | | 1 | 456 | 0.1 | C | | 1 | 567 | 0.1 | G

Re: MySQL select matching

2010-07-19 Thread Michael Dykman
Not quite sure what the question is. from: mysql select * from table where id='1'; +---+-+-+---+ | 1 | 123 | 0.0 | C | | 1 | 234 | 0.1 | D | | 1 | 345 | 0.0 | D | | 1 | 456 | 0.1 | C | | 1 | 567 | 0.1 | G | +---+-+-+---+ How do we deduce

Re: MySQL select matching

2010-07-19 Thread Shawn Green (MySQL)
| 456 | 0.1 | C | | 3 | 567 | 0.1 | G | | 4 | 123 | 0.0 | C | | 4 | 234 | 0.1 | D | | 4 | 345 | 0.0 | D | +---+-+-+---+ mysql select * from table where id='1'; +---+-+-+---+ | 1 | 123 | 0.0 | C | | 1 | 234 | 0.1 | D | | 1 | 345 | 0.0 | D

Re: [MySQL] Re: MySQL select matching

2010-07-19 Thread Ashley M. Kirchner
On 7/19/2010 10:48 AM, Michael Dykman wrote: Not quite sure what the question is. from: mysql select * from table where id='1'; +---+-+-+---+ | 1 | 123 | 0.0 | C | | 1 | 234 | 0.1 | D | | 1 | 345 | 0.0 | D | | 1 | 456 | 0.1 | C | | 1 | 567 | 0.1 | G

Re: [MySQL] Re: MySQL select matching

2010-07-19 Thread Ashley M. Kirchner
On 7/19/2010 11:08 AM, Shawn Green (MySQL) wrote: Just because someone hands you a set of data to *start* with, does not mean that you must only use that data to *work* with. You should be able create additional tables derived from the original data and work with those as part of your

Re: [MySQL] Re: MySQL select matching

2010-07-19 Thread Peter Brawley
Ashley, I can't go back to the client and tell them their schema is really messed up and to store their data differently. You can hope that's not not necessary in order to deliver the requested query, but it's a bad mistake to rule it out altogether, since it often happens that

Select ROW_COUNT() INTO a variable

2010-07-19 Thread Bryan Cantwell
AND ', histUnixTime, ' '); PREPARE s1 FROM @sql; EXECUTE s1; SELECT ROW_COUNT() INTO dropCnt; DEALLOCATE PREPARE s1; ... The problem here is that SELECT ROW_COUNT() INTO dropCnt; returns NULL every time. If I just do the select without

Re: Select ROW_COUNT() INTO a variable

2010-07-19 Thread Shawn Green (MySQL)
= ', iID, ' AND clock BETWEEN 0 AND ', histUnixTime, ' '); PREPARE s1 FROM @sql; EXECUTE s1; SELECT ROW_COUNT() INTO dropCnt; DEALLOCATE PREPARE s1; ... The problem here is that SELECT ROW_COUNT() INTO dropCnt; returns NULL

Select w/ group by question

2010-07-14 Thread Scott Mullen
Walmart pear 2 1 Walmart (Note: both vendors 1 and 3 have the same cost which is the lowest. I'm not really concerned with which vendor is chosen in the result set here.) If I do: select a.type, min(a.cost), a.vendor_id, b.vendor_name from

Re: Select w/ group by question

2010-07-14 Thread Peter Brawley
Walmart (Note: both vendors 1 and 3 have the same cost which is the lowest. I'm not really concerned with which vendor is chosen in the result set here.) If I do: select a.type, min(a.cost), a.vendor_id, b.vendor_name from products a join vendors b on a.vendor_id = b.vendor_id group

Re: Select w/ group by question

2010-07-14 Thread Michael Satterwhite
in the result set here.) Try this: select name, product_type, min(cost) from vendors join products on vendors.id = products.vendor_id group by product_type; -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql

RE: Select w/ group by question

2010-07-14 Thread Martin Gainty
Date: Wed, 14 Jul 2010 10:25:22 -0400 Subject: Select w/ group by question From: smulle...@gmail.com To: mysql@lists.mysql.com I'm having trouble formulating a query to gather the following data. I can do this via a script, but now it is more or less just bothering me

Re: Select w/ group by question

2010-07-14 Thread Scott Mullen
Peter Thanks for the link. I've never run across this page before, but it has tons of useful informationas well as several answers on how to implement what I was trying to do. Ended up going with a solution similar to this example (from the page you referenced): SELECT item, SUBSTR

Re: Problem with IF() inside of a select statement

2010-07-11 Thread Shawn Green (MySQL)
On 7/8/2010 10:59 AM, John Nichel wrote: Hi, I'm hoping what I'm trying to do can be done, but I can't seem to find the right syntax. I have the following query: SELECT ... snipped

Re: Slow disk access: 1.4m to do a select count over 23GB table.

2010-07-10 Thread Rob Wultsch
On Fri, Jul 9, 2010 at 9:09 PM, Andrés Tello mr.crip...@gmail.com wrote: Hi, I'm using mysql 4.1.21, a legacy system. Next step to migrate it, but for now, I need the community help. I have a 23GB table, if I do a select count(over_an_index) from table it uses 1.4minutes to read. The main

Re: Slow disk access: 1.4m to do a select count over 23GB table.

2010-07-10 Thread Andrés Tello
As usual, after you send a mail, you check for other things From the 32GB of ram, I only was allocating 2G, not by the process, but by all the S.O... free -G reported barely 1 gig of ram... XD - happy face that I have lots of ram... now my face is like: ¬¬ - why I didn't verfy the amount of

Slow disk access: 1.4m to do a select count over 23GB table.

2010-07-09 Thread Andrés Tello
Hi, I'm using mysql 4.1.21, a legacy system. Next step to migrate it, but for now, I need the community help. I have a 23GB table, if I do a select count(over_an_index) from table it uses 1.4minutes to read. The main issue is that this table is the main table of a system and each query is taking

Problem with IF() inside of a select statement

2010-07-08 Thread John Nichel
Hi, I'm hoping what I'm trying to do can be done, but I can't seem to find the right syntax. I have the following query: SELECT a.productid, a.productcode, a.product

Re: Problem with IF() inside of a select statement

2010-07-08 Thread Peter Brawley
Is there a way I can do a IF((SELECT.), expr2, expr3) and have expr2 populate with whatever is returned from the select statement? Yes, select if( (select count(*) from mytable ) 100, 1, 0) works fine. The alias inside your last If(...), though, is not visible outside its parentheses

RE: Problem with IF() inside of a select statement

2010-07-08 Thread John Nichel
-Original Message- From: Peter Brawley [mailto:peter.braw...@earthlink.net] Sent: Thursday, July 08, 2010 12:27 PM To: mysql@lists.mysql.com Subject: Re: Problem with IF() inside of a select statement Is there a way I can do a IF((SELECT.), expr2, expr3) and have expr2

How to select rows from only the first N rows in a table?

2010-04-27 Thread Peng Yu
It seems that there is no direct support to limit 'select' to only the first N rows in a table. Could you let me know what the best way select rows from the first N rows in a table is? -- Regards, Peng -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe

Re: How to select rows from only the first N rows in a table?

2010-04-27 Thread Martijn Tonies
It seems that there is no direct support to limit 'select' to only the first N rows in a table. Could you let me know what the best way select rows from the first N rows in a table is? LIMIT usually works fine ;-) http://dev.mysql.com/doc/refman/5.0/en/select.html With regards, Martijn

Re: How to select rows from only the first N rows in a table?

2010-04-27 Thread Dan Nelson
In the last episode (Apr 27), Martijn Tonies said: It seems that there is no direct support to limit 'select' to only the first N rows in a table. Could you let me know what the best way select rows from the first N rows in a table is? LIMIT usually works fine ;-) http://dev.mysql.com

Re: How to select rows from only the first N rows in a table?

2010-04-27 Thread Martijn Tonies
In the last episode (Apr 27), Martijn Tonies said: It seems that there is no direct support to limit 'select' to only the first N rows in a table. Could you let me know what the best way select rows from the first N rows in a table is? LIMIT usually works fine ;-) http

Getting Array to display on SELECT

2010-04-20 Thread Gary
I'm frankly not sure if this is a MySQL question or PHP, but I thought I would start here. I have a form that I have a (ever growing) list of checkboxes, Here is a sample of the code for it. input name=keyword[] type=checkbox value=fox / It seems to go in, when I say seems to, I get a

RE: Getting Array to display on SELECT

2010-04-20 Thread Gavin Towey
This is a PHP question. -Original Message- From: Gary [mailto:g...@paulgdesigns.com] Sent: Tuesday, April 20, 2010 3:17 PM To: mysql@lists.mysql.com Subject: Getting Array to display on SELECT I'm frankly not sure if this is a MySQL question or PHP, but I thought I would start here. I

RE: Getting Array to display on SELECT

2010-04-20 Thread Martin Gainty
to display on SELECT Date: Tue, 20 Apr 2010 18:16:52 -0400 I'm frankly not sure if this is a MySQL question or PHP, but I thought I would start here. I have a form that I have a (ever growing) list of checkboxes, Here is a sample of the code for it. input name=keyword[] type=checkbox

Re: SELECT and INSERT if no row is returned

2010-03-24 Thread Johnny Withers
Make parent_id a unique key. Doing a select first and inserting if no result will work 99.9% of the time; however, consider 2 rows being inserted at the same time. JW On Tuesday, March 23, 2010, Kyong Kim kykim...@gmail.com wrote: I need to INSERT a row into a table only if it does not exist

Re: SELECT and INSERT if no row is returned

2010-03-24 Thread Rodrigo Ferreira
...@pixelated.net Subject: Re: SELECT and INSERT if no row is returned To: Kyong Kim kykim...@gmail.com Cc: mysql mysql@lists.mysql.com Date: Wednesday, March 24, 2010, 9:32 AM Make parent_id a unique key. Doing a select first and inserting if no result will work 99.9% of the time; however, consider 2 rows

Re: SELECT and INSERT if no row is returned

2010-03-24 Thread Kyong Kim
(child_id) ) ENGINE=INNODB; The requirement is that there can be only 1 parent_id associated with a given child or there can be only one parent_id not associated with a child_id (NULL child_id). I need to avoid a race condition where 2 connections can SELECT and return an empty row and insert rows

Re: SELECT and INSERT if no row is returned

2010-03-24 Thread Shawn Green
, seq_id), UNIQUE KEY(child_id) ) ENGINE=INNODB; The requirement is that there can be only 1 parent_id associated with a given child or there can be only one parent_id not associated with a child_id (NULL child_id). I need to avoid a race condition where 2 connections can SELECT and return an empty row

SELECT and INSERT if no row is returned

2010-03-23 Thread Kyong Kim
I need to INSERT a row into a table only if it does not exist to insure that there won't be duplicate rows. Due to the the usage case and the design of the primary key, non-unique id + auto increment, I don't think insert ignore is an option. What would be simplest and cheapest way to make sure

Re: 5.1.44 community version select ordno=' ' error (2)

2010-03-04 Thread wang shuming
DEFAULT '', `mem` char(1) DEFAULT '', PRIMARY KEY (`mid`), KEY `key03` (`ordno`)) select * from t1 where ordno=' ' gets wrong result 2 rows 2CREATE TABLE `t1` ( `mid` int(11) NOT NULL, `qty` decimal(12,2) NOT NULL DEFAULT '0.00', `ordno` char(8) NOT NULL DEFAULT '', `mem` char(1

Re: 5.1.44 community version select ordno=' ' error (2)

2010-03-04 Thread Peter Brawley
Wang, select * from t1 where ordno=' ' gets wrong result 2 rows I doubt you'll get many helpful responses till you post the INSERTs. PB - wang shuming wrote: Oh, If any char fields add to index key ,then the =' ' gets wrong . ordno, qty ,mem 1 3

5.1.44 community version select ordno=' ' error (2)

2010-03-03 Thread wang shuming
Hi, select * from t1 ordno qty 1 3 5 'aaa' 18 'b' 20 select * from t1 where ordno=' ' or ordno' ' ordno qty 1 3 5 'aaa' 18 'b' 20 select * from t1 where ordno=' ' ordno qty 'aaa' 18 'b

Re: 5.1.44 community version select ordno=' ' error (2)

2010-03-03 Thread Dan Nelson
In the last episode (Mar 04), wang shuming said: select * from t1 ordno qty 1 3 5 'aaa' 18 'b' 20 Are your first three rows really blank, or are there nonprintable characters in 'ordno' that aren't showing up here? You need to provide us

5.1.42 community version select ordno=' ' error

2010-03-01 Thread wang shuming
Hi, Any table with a ordno char(n) not null field for example ordno qty 35 0 1 'abc' 3 '000' 100 select * from table1 where ordno' ' or ordno=' ' 3 rows select * from table1 where ordno=' ' 0 rows best regard! Shuming

5.1.42 community version select ordno=' ' error (2)

2010-03-01 Thread wang shuming
Hi, Any table with a ordno char(n) not null field for example ordno qty 35 0 1 'abc' 3 '000' 100 select * from table1 where ordno' ' or ordno=' ' 5 rows select * from table1 where ordno=' ' 2 rows best regard! Shuming

<    1   2   3   4   5   6   7   8   9   10   >