Re: Narrowing a SELECT statement by multiple hits

2014-02-17 Thread Jennifer
_ip referenced a complete SELECT statement from before, that was good enough, but no. There's always something new to learn! Thanks again, Jenni Superior Shelving Systems The (Storage|Office|Display|Warehouse) Shelving Specialists Since 1984

Re: Narrowing a SELECT statement by multiple hits

2014-02-17 Thread shawn l.green
Hi Jennifer, On 2/17/2014 3:11 PM, Jennifer wrote: CREATE TEMPORARY TABLE temp_ip AS (SELECT `ip` FROM `ip_addresses` WHERE (`time_stamp` BETWEEN date_add( CURDATE(), INTERVAL -1 DAY ) AND CURDATE() - INTERVAL 1 SECOND) AND TRIM(`referrer`) LIKE '' GROUP BY `ip` HAVING COUNT(

Re: Narrowing a SELECT statement by multiple hits

2014-02-17 Thread Roy Lyseng
Hi Jennifer, great that it worked. Try replacing the line `ip` IN (temp_ip) with `ip` IN (SELECT ip FROM temp_ip) Each subquery needs to be a complete SELECT query. Thanks, Roy On 17.02.14 21:11, Jennifer wrote: On Feb 17, 2014, at 10:17 AM, Roy Lyseng wrote: please try filtering wit

Re: Narrowing a SELECT statement by multiple hits

2014-02-17 Thread Jennifer
On Feb 17, 2014, at 10:17 AM, Roy Lyseng wrote: > please try filtering with a subquery that locates ip addresses with more than > 1 attempt: Hi Roy, That did it! Thank you so much!!! Now I just need to study that IN clause to see what's going on there. > If this is too slow, you may

Re: Narrowing a SELECT statement by multiple hits

2014-02-17 Thread Roy Lyseng
Hi Jennifer, please try filtering with a subquery that locates ip addresses with more than 1 attempt: SELECT ip, page, url, time_stamp FROM ip_adresses WHERE AND ip IN (SELECT ip FROM ip_addresses WHERE GROUP BY ip HAVING COUNT(*) > 1

Re: Narrowing a SELECT statement by multiple hits

2014-02-17 Thread Jennifer
On Feb 12, 2014, at 6:30 PM, Larry Martell wrote: > Try adding a having clause, e.g.: > > SELECT `ip`,`page`,`url`,`time_stamp` > FROM `ip_addresses` > WHERE (`time_stamp` BETWEEN date_add( CURDATE(), INTERVAL -1 DAY ) AND > CURDATE() - INTERVAL 1 SECOND) > AND TRIM(`referrer`) LIKE '' > HAVING C

Re: Narrowing a SELECT statement by multiple hits

2014-02-12 Thread Larry Martell
On Wed, Feb 12, 2014 at 7:35 PM, Jennifer wrote: > Hello, > > I have the following SQL statement that I'd like to add to. It's > used to create a report that's emailed to me showing hits to our site that > didn't provide a referrer. However, I only want to report on multiple hits > fr

Narrowing a SELECT statement by multiple hits

2014-02-12 Thread Jennifer
Hello, I have the following SQL statement that I'd like to add to. It's used to create a report that's emailed to me showing hits to our site that didn't provide a referrer. However, I only want to report on multiple hits from the same IP address - not just a single hit by someone.

Re: Complex MySQL Select Statement Help

2013-02-03 Thread hsv
2013/02/02 12:58 -0600, Peter Brawley On 2013-02-01 10:18 PM, h...@tbbs.net wrote: >2013/01/31 22:24 -0600, Peter Brawley >Is this what you mean? > >Select, >pricelist >If( !IsNull(specialprice) And specialprice < unitprice And CurDate() Between >startingDate And endingDate, >sp

Re: Complex MySQL Select Statement Help

2013-02-02 Thread Peter Brawley
On 2013-02-01 10:18 PM, h...@tbbs.net wrote: 2013/01/31 22:24 -0600, Peter Brawley Is this what you mean? Select, pricelist If( !IsNull(specialprice) And specialprice < unitprice And CurDate() Between startingDate And endingDate, specialprice, unitprice ) as used_price >From catalog Where

Re: Complex MySQL Select Statement Help

2013-02-02 Thread hsv
2013/01/31 22:24 -0600, Peter Brawley Is this what you mean? Select, pricelist If( !IsNull(specialprice) And specialprice < unitprice And CurDate() Between startingDate And endingDate, specialprice, unitprice ) as used_price >From catalog Where itemid='WB314'; PB Maybe this i

Re: Complex MySQL Select Statement Help

2013-01-31 Thread Peter Brawley
On 2013-01-31 8:13 PM, Angela Barone wrote: Hello, I'm trying to write a select query that grabs two prices from my db and displays them on a web page. I want it to grab the `listprice`, and either the `unitprice` or the `specialprice` depending on the following criteria: if the `spec

Complex MySQL Select Statement Help

2013-01-31 Thread Angela Barone
Hello, I'm trying to write a select query that grabs two prices from my db and displays them on a web page. I want it to grab the `listprice`, and either the `unitprice` or the `specialprice` depending on the following criteria: if the `specialprice` is not empty, AND it's less than the

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

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 -userna

Re: export result from select statement

2011-01-09 Thread Yogesh Kore
gt;> 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

Re: export result from select statement

2011-01-09 Thread LAMP
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 SELECT query? not a whole table nor database

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 wrote: Hi guys, I wonder how to store to csv or txt file result from SELECT query? n

Re: export result from select statement

2011-01-09 Thread Michael Dykman
foshop.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 resu

RE: export result from select statement

2011-01-09 Thread Jerry Schwartz
.8796 / FAX: 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 won

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 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 query. > Usua

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 acces

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 ... if( ( selec

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

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 parenthe

Problem with IF() inside of a select statement

2010-07-08 Thread John Nichel
limit 1 ) > 0, d.date, 0 ) as last_sold FROM products a The query is erroring out on 'd.date' in expression two of the if statement, "#1109 - Unknown table 'd' in field list"

Re: Second Request: Challenging Select Statement

2009-12-07 Thread Victor Subervi
On Mon, Dec 7, 2009 at 8:08 AM, Tom Worster wrote: > On 12/7/09 5:26 AM, "Victor Subervi" wrote: > > > Hi; > > I posted this Saturday. Perhaps it's too challenging for those who read > it > > to answer. I hope someone can. > > > > I need

Re: Second Request: Challenging Select Statement

2009-12-07 Thread Tom Worster
On 12/7/09 5:26 AM, "Victor Subervi" wrote: > Hi; > I posted this Saturday. Perhaps it's too challenging for those who read it > to answer. I hope someone can. > > I need to write a select statement that enables me to select column 'ID' > from a tabl

Second Request: Challenging Select Statement

2009-12-07 Thread Victor Subervi
Hi; I posted this Saturday. Perhaps it's too challenging for those who read it to answer. I hope someone can. I need to write a select statement that enables me to select column 'ID' from a table where a certain value is found in an enum of a specific column. For example... sel

Challenging Select Statement

2009-12-05 Thread Victor Subervi
Hi; I need to write a select statement that enables me to select column 'ID' from a table where a certain value is found in an enum of a specific column. For example... select column_type from information_schema.columns where table_name='products' and column_name='Categ

Re: Select Statement

2008-03-12 Thread Sebastian Mendel
Velen schrieb: Hi, I need to write up a select statement something like: Select a.supcode,a.code,b.desc,sum(c.qty),c.dept where a.supcode=b.supcode and a.code=c.code and a.code=b.code and c.dept between $tring1 and $tring2. group by supcode This is fine but the problem is that there is

Re: Select Statement

2008-03-10 Thread Baron Schwartz
On Mon, Mar 10, 2008 at 1:38 PM, Peter Brawley <[EMAIL PROTECTED]> wrote: > Velen, > > >My problem is that it is displaying a.sale_id but different customer_name > >as it is taking sale_id from d and matching cust_code with b > > Any non-aggregate SELECTed value that does not have a 1:1 relati

Re: Select Statement

2008-03-10 Thread Peter Brawley
Velen, >My problem is that it is displaying a.sale_id but different customer_name >as it is taking sale_id from d and matching cust_code with b Any non-aggregate SELECTed value that does not have a 1:1 relationship with your GROUP BY column will show arbitrary results, so the first thing to ge

Re: Select Statement

2008-03-10 Thread Velen
In fact my sql statement is like this: "select b.customer_name Customer,a.sale_id DocNo,a.sale_date Date,a.prod_code Product,a.quantity Quantity,c.cost_price Cost,a.price Price, c.prod_description,a.store,d.payMode from sale_trans a,customer_master b,prod_master c,saletrans_cons d where a.sale

Re: Select Statement

2008-03-10 Thread Sebastian Mendel
Velen schrieb: Hi, I need to write up a select statement something like: Select a.supcode,a.code,b.desc,sum(c.qty),c.dept where a.supcode=b.supcode and a.code=c.code and a.code=b.code and c.dept between $tring1 and $tring2. group by supcode This is fine but the problem is that there is

Select Statement

2008-03-10 Thread Velen
Hi, I need to write up a select statement something like: Select a.supcode,a.code,b.desc,sum(c.qty),c.dept where a.supcode=b.supcode and a.code=c.code and a.code=b.code and c.dept between $tring1 and $tring2. group by supcode This is fine but the problem is that there is duplicate supcode

Re: Select Statement

2008-03-06 Thread Thomas Pundt
Hi, [EMAIL PROTECTED] schrieb: Hi, I have 2 tables as follows: table 1 contains code,order_qty table 2 contains code,stock_qty table 1: code1, 10 code2, 2 code3, 5 table 2: code1, 3 code3, 5 code1, 4 code3, 2 I need to see the following result: code | order_qty| stock_qty code1 | 10

Select Statement

2008-03-05 Thread velen
Hi, I have 2 tables as follows: table 1 contains code,order_qty table 2 contains code,stock_qty table 1: code1, 10 code2, 2 code3, 5 table 2: code1, 3 code3, 5 code1, 4 code3, 2 I need to see the following result: code | order_qty| stock_qty code1 | 10 | 7 code2 | 2| 0 The

Re: Select statement help

2008-01-18 Thread Baron Schwartz
Hi, On Jan 18, 2008 2:59 PM, RoryGRen <[EMAIL PROTECTED]> wrote: > > Hi all > > I am quite new to mySQL and have the following question I hope someone can > help me with: > > I have a database table imported directly from MS Access with two of the > field names having brackets - F(1) and S(1). I d

Select statement help

2008-01-18 Thread RoryGRen
when the database needs updating. How can I select these fields from the table? - SELECT F(1), S(1) doesn't work, SELECT "F(1)" , "S(1)" doesn't work and neither does SELECT [F(1)], [S(1)] Thanks, in anticipation! Rory -- View this message in context: http://w

Re: MySQL SELECT Statement with Date help request

2008-01-09 Thread Brent Baisley
07-03-01 db3 : 2007-03-01 to 2007-04-01 db4 : 2007-04-01 to 2007-05-01 db5 : 2007-05-01 to 2007-06-01 db6 : 2007-06-01 to 2007-07-01 I require a select statement to query all the db's to identify records with the date range for eg. 2007-02-15 to 2007-05-12. Logically this tells me that the

MySQL SELECT Statement with Date help request

2008-01-09 Thread Cx Cx
2007-03-01 db3 : 2007-03-01 to 2007-04-01 db4 : 2007-04-01 to 2007-05-01 db5 : 2007-05-01 to 2007-06-01 db6 : 2007-06-01 to 2007-07-01 I require a select statement to query all the db's to identify records with the date range for eg. 2007-02-15 to 2007-05-12. Logically this tells me tha

Can slow-query-log option only record select statement?

2007-12-20 Thread Moon's Father
I want to know how to configurate slow-query-log to let it not record the update sql. I just want to know how the slow select statement ,not the update or insert. Anybody's reply is appreciated,thanks. -- I'm a mysql DBA in china. More about me just visit here: http://yueliangdao0608.cublog.cn

Re: Question related to INSERT statement into table1 and SELECT statement from table1 to populate a column field into table1

2007-09-12 Thread Martijn Tonies
> > I have a table with a PRIMARY KEY on id field, whos > > evalue is populated usin auto_increment. > > > > > > CREATE TABLE `key` ( > > `id` int(10) unsigned NOT NULL AUTO_INCREMENT, > > `sid` smallint(4) unsigned NOT NULL DEFAULT '0', > > `email` varchar(128) NOT NULL DEFAULT '', > > PRIM

Re: Question related to INSERT statement into table1 and SELECT statement from table1 to populate a column field into table1

2007-09-12 Thread Martijn Tonies
Hi, > I have a table with a PRIMARY KEY on id field, whos > evalue is populated usin auto_increment. > > > CREATE TABLE `key` ( > `id` int(10) unsigned NOT NULL AUTO_INCREMENT, > `sid` smallint(4) unsigned NOT NULL DEFAULT '0', > `email` varchar(128) NOT NULL DEFAULT '', > PRIMARY KEY (`id`)

Question related to INSERT statement into table1 and SELECT statement from table1 to populate a column field into table1

2007-09-12 Thread Mariella Petrini
Hi All, I have a table with a PRIMARY KEY on id field, whos evalue is populated usin auto_increment. CREATE TABLE `key` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `sid` smallint(4) unsigned NOT NULL DEFAULT '0', `email` varchar(128) NOT NULL DEFAULT '', PRIMARY KEY (`id`), UNIQUE K

RE: select statement with variable for table_reference?

2007-06-28 Thread Price, Randall
4 rows in set (0.27 sec) Query OK, 0 rows affected (0.28 sec) Hope this helps. Randall Price Secure Enterprise Technology Initiatives Microsoft Implementation Group Virginia Tech Information Technology 1700 Pratt Drive Blacksburg, VA 24060 Email: [EMAIL PROTECTED] Phone: (540) 231-

Re: select statement with variable for table_reference?

2007-06-27 Thread Octavian Rasnita
From: "Ed Lazor" <[EMAIL PROTECTED]> To: "'Octavian Rasnita'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Cc: Sent: Wednesday, June 27, 2007 8:02 PM Subject: RE: select statement with variable for table_reference? Hi Octavian, First, thanks for helping

RE: select statement with variable for table_reference?

2007-06-27 Thread Ed Lazor
t; Octavian > > - Original Message - > From: "Ed Lazor" <[EMAIL PROTECTED]> > To: "'Octavian Rasnita'" <[EMAIL PROTECTED]>; > Sent: Tuesday, June 26, 2007 11:37 PM > Subject: RE: select statement with variable for tab

RE: select statement with variable for table_reference?

2007-06-27 Thread Price, Randall
Statement; I guess what I am saying here is that the PREPARED STATEMENTS allow you to basically construct any SQL statement you want and works when you want to use a variable in places where they are usually not allowed (i.e., like table names, passing in a variable number of fields for the SELECT

Re: select statement with variable for table_reference?

2007-06-26 Thread Octavian Rasnita
o: "'Octavian Rasnita'" <[EMAIL PROTECTED]>; Sent: Tuesday, June 26, 2007 11:37 PM Subject: RE: select statement with variable for table_reference? Ok, I used your approach like this: -- select i.scanned_barcode

RE: select statement with variable for table_reference?

2007-06-26 Thread Ed Lazor
Implementation Group > Virginia Tech Information Technology > 1700 Pratt Drive > Blacksburg, VA 24060 > > Email: [EMAIL PROTECTED] > Phone: (540) 231-4396 > > -Original Message- > From: Ed Lazor [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 26, 2007 4:37 PM

RE: select statement with variable for table_reference?

2007-06-26 Thread Ed Lazor
Thanks for the info Jerry. =) > -Original Message- > From: Jerry Schwartz [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 26, 2007 1:59 PM > To: 'Ed Lazor'; 'Octavian Rasnita'; mysql@lists.mysql.com > Subject: RE: select statement with variable for ta

RE: select statement with variable for table_reference?

2007-06-26 Thread Price, Randall
vian Rasnita'; mysql@lists.mysql.com Subject: RE: select statement with variable for table_reference? Ok, I used your approach like this: -- select i.scanned_barcode, v.title from inventory as i left join version as v on i.record_id = v.id wher

RE: select statement with variable for table_reference?

2007-06-26 Thread Jerry Schwartz
, 2007 4:37 PM > To: 'Octavian Rasnita'; mysql@lists.mysql.com > Subject: RE: select statement with variable for table_reference? > > Ok, I used your approach like this: > > -- > select i.scanned_barcode, v.tit

RE: select statement with variable for table_reference?

2007-06-26 Thread Ed Lazor
has something in there or not. Improving on this idea would be finding a way to just query the relevant tables... some sort of conditional union. Any ideas? -Ed > -Original Message- > From: Octavian Rasnita [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 26, 2007 1:02 PM > To: E

Re: select statement with variable for table_reference?

2007-06-26 Thread Octavian Rasnita
) where ... order by ... limit ...; Octavian - Original Message - From: "Ed Lazor" <[EMAIL PROTECTED]> To: Sent: Tuesday, June 26, 2007 10:39 PM Subject: select statement with variable for table_reference? Is there a way to get something like this to work? Set @tname="mytab

select statement with variable for table_reference?

2007-06-26 Thread Ed Lazor
Is there a way to get something like this to work? Set @tname="mytable"; Select * from @tname; Here's what I'm trying to really accomplish in case there is yet another way to approach this... I have to work with product data from multiple databases and multiple tables. For example, one databas

Re: SELECT statement returning columns for a given table?

2007-05-13 Thread Peter Brawley
>I thought the 'mysql' system db may have this info, but it doesn't seem to. In 5.0 & later MySQL implements the ISO SQL spec for information_schema, which does that. PB ----- Kelly Jones wrote: In PostgreSQL, the following SELECT statement will return all the c

Re: SELECT statement returning columns for a given table?

2007-05-13 Thread Baron Schwartz
Hi Kelly, Kelly Jones wrote: In PostgreSQL, the following SELECT statement will return all the columns for 'tabname': SELECT x.attname FROM pg_attribute x, pg_class y WHERE x.attrelid=y.oid AND relname='tabname'; Does MySQL have anything similar? I know about "SHOW C

SELECT statement returning columns for a given table?

2007-05-13 Thread Kelly Jones
In PostgreSQL, the following SELECT statement will return all the columns for 'tabname': SELECT x.attname FROM pg_attribute x, pg_class y WHERE x.attrelid=y.oid AND relname='tabname'; Does MySQL have anything similar? I know about "SHOW COLUMNS FROM tabname", but

Re: select statement question

2007-01-05 Thread Brent Baisley
FROM A LEFT JOIN B ON A.C=B.D WHERE B.D IS NULL - Original Message - From: "Aaron Cannon" <[EMAIL PROTECTED]> To: Sent: Wednesday, January 03, 2007 3:47 PM Subject: select statement question -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all. I hope this is the ri

Re: select statement question

2007-01-03 Thread Chris White
Aaron Cannon wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all. I hope this is the right place to ask this. I have two tables, A and B. Each of these tables has a column with integers. The column in table A is C and the one in B is D. SELECT c.value FROM c WHERE c.value NOT IN

RE: select statement question

2007-01-03 Thread Jerry Schwartz
om > Subject: select statement question > > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hi all. I hope this is the right place to ask this. > > I have two tables, A and B. Each of these tables has a column with > integers. The column in table A is C and

select statement question

2007-01-03 Thread Aaron Cannon
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all. I hope this is the right place to ask this. I have two tables, A and B. Each of these tables has a column with integers. The column in table A is C and the one in B is D. I need a select statement that will return all records whose C

Re: loop through SELECT statement query results in a Trigger

2006-10-27 Thread Waldemar Jankowski
abel1: LOOP IF (pets row.pet_type) = 4 THEN SET properly_trained = 1; ITERATE label1; END IF; LEAVE label1; END LOOP label1; SET @x = p1; END Is this possible. Can you loop through the query results of a SELECT statement in a trigger, function, or procedure. Ferindo Check out the secti

loop through SELECT statement query results in a Trigger

2006-10-27 Thread Ferindo Middleton
SET properly_trained = 1; ITERATE label1; END IF; LEAVE label1; END LOOP label1; SET @x = p1; END Is this possible. Can you loop through the query results of a SELECT statement in a trigger, function, or procedure. Ferindo

Re: Hi, newbie question on a select statement

2006-02-20 Thread sheeri kritzer
agent returns only strings and I didn't find enough a reason for > converting the different types of answers, since most string comparations are > donde correctly; I received both text and numbers from the monitoring tasks > and wanted to keep it simple. > > However

RE: Hi, newbie question on a select statement

2006-02-16 Thread Logan, David (SST - Adelaide)
ECTED] Sent: Friday, 17 February 2006 11:29 AM To: mysql@lists.mysql.com Subject: Hi, newbie question on a select statement I searched the other lists and couldn't find one that was more appropiate for this question; if there is, please tell me so :) I am monitoring networking equipment and

Hi, newbie question on a select statement

2006-02-16 Thread Ariel Sánchez Mora
cause the SNMP agent returns only strings and I didn't find enough a reason for converting the different types of answers, since most string comparations are donde correctly; I received both text and numbers from the monitoring tasks and wanted to keep it simple. However when I execute this s

Re: Do I need to tweak my server variables for this SELECT statement?

2005-12-23 Thread Hank
Based on the size (and # of colums) of your result set, I'm not sure any amount of RAM would allow 360,000 records to be stored and sorted entirely in memory. After some point, mysql just decideds to use a temp table. That's the limit of my tweaking skills, so someone else is going to have to hel

Re: Do I need to tweak my server variables for this SELECT statement?

2005-12-23 Thread Grant Giddens
Thanks James. I'll definately give that a try. My test server has 1 gig of ram. In the my-huge.cnf example it says that it's mainly for servers that have mysql as the main process. On my production server, I have 1 gig of ram, but it also runs apache, mutliple webstites, mysql, DNS, ftp

Re: Do I need to tweak my server variables for this SELECT statement?

2005-12-23 Thread James Harvard
The reason I suggested that you just use the alternative my-huge.cnf file is because that is a ready-prepared config file optimised for systems with lots of RAM for MySQL to use. You don't need to know which variable to change - it's already done for you. You may want/need to tweak stuff later,

Re: Do I need to tweak my server variables for this SELECT statement?

2005-12-23 Thread Grant Giddens
Thanks Hank. I'll try to split up the query into 2 separate queries. I think that the reason the original query is so slow is that I don't have enough RAM allocated to mysql. When the original query takes place, I see a process "Copying to tmp table on disk". I believe it's writing all t

Re: Do I need to tweak my server variables for this SELECT statement?

2005-12-22 Thread Hank
> Now that I know what's causing the slow queries, what can I do to fix it? The only thing I can suggest is breaking up the query into two parts - the first part to retrieve just the product codes and salesrank, and sort and limit that.. save in a temp table or use application code to retrieve and

Re: Do I need to tweak my server variables for this SELECT statement?

2005-12-21 Thread Grant Giddens
OK, I tried the following queries: 1. Use the ORDER BY and not the LIMIT <-- still slow 2. Use the LIMIT and not the ORDER BY <-- fast So it looks like it's building a whole temp table with all the items and then doing the ORDER BY. Just as a test, I removed the INDEX fr

Re: Do I need to tweak my server variables for this SELECT statement?

2005-12-21 Thread Grant Giddens
It'll be a few hours before I get home and can do this query with the variations you mentioned. I don't know if I need the separate index key on `salesrank` or not. I thought it would speed up my query be having it. In the previous email I included the results from doing an EXPLAIN. It

Re: Do I need to tweak my server variables for this SELECT statement?

2005-12-21 Thread Hank
Ok, so the next step would be to try the original query with just the LIMIT clause, and then just the ORDER BY (but not both). The results of "select count(*)" query would be helpful to know just how many records mysql is trying to sort and limit. And do you really need a separte index key on `sa

Re: Do I need to tweak my server variables for this SELECT statement?

2005-12-21 Thread Grant Giddens
OK guys, Here is are my tables and test SELECT queries. Before every query I did a FLUSH TABLES command. Before starting these test, I did and ANALYIZE and OPTIMIZE on all the tables. Hopefully the formatting of this email isn't too bad. product table: show create table pn

Re: Do I need to tweak my server variables for this SELECT statement?

2005-12-21 Thread SGreen
Hank <[EMAIL PROTECTED]> wrote on 12/21/2005 09:39:50 AM: > Grant, > > You can just to a "desc pn_pricecompare_catprod" and "desc > pn_pricecompare_product" and post the results. The CREATE TABLE > statements would be OK, but the describes are better. > > The flush the query cache, I think if

Re: Do I need to tweak my server variables for this SELECT statement?

2005-12-21 Thread Hank
Grant, You can just to a "desc pn_pricecompare_catprod" and "desc pn_pricecompare_product" and post the results. The CREATE TABLE statements would be OK, but the describes are better. The flush the query cache, I think if you do a "flush tables". -Hank -- MySQL General Mailing List For list

Re: Do I need to tweak my server variables for this SELECT statement?

2005-12-21 Thread James Harvard
That's why I suggested simply using the supplied my-huge.cnf config file, because I assume it was contructed by some MySQL uber-guru who does know how much RAM to allocate to each variable! James Harvard > Like I mentioned before, I am tweaking the .cnf files by blind trial and > error. I w

Re: Do I need to tweak my server variables for this SELECT statement?

2005-12-21 Thread Grant Giddens
Thank Hank. I will try this. When you say the table descriptions, do you mean for me to post my CREATE TABLE syntax of how I created the table? Thanks, Grant Hank <[EMAIL PROTECTED]> wrote: I don't think the problem is going to be solved with the my.cnf file. Here's what I would try

Re: Do I need to tweak my server variables for this SELECT statement?

2005-12-21 Thread Hank
I don't think the problem is going to be solved with the my.cnf file. Here's what I would try.. 1- run and time the original query without the ORDER BY or LIMIT clauses 2- run and time the following breakdown queries, to see if the indexes are at least working correctly: -- test catprod SELECT

Re: Do I need to tweak my server variables for this SELECT statement?

2005-12-21 Thread Grant Giddens
iated with. My SELECT statment just > grabs 10 products that are associated with a specific category. The product > table has 650,000 rows and the category table has 8,150,000 rows. > > My SELECT statement is: > > SELECT pn_pricecompare_catprod.category, pn_pricecompare_catprod

Re: Do I need to tweak my server variables for this SELECT statement?

2005-12-21 Thread James Harvard
> > I've got 2 tables, one that holds a list of product, the other holds a list > of categories that the product is associated with. My SELECT statment just > grabs 10 products that are associated with a specific category. The product > table has 650,00

Do I need to tweak my server variables for this SELECT statement?

2005-12-20 Thread Grant Giddens
ated with a specific category. The product table has 650,000 rows and the category table has 8,150,000 rows. My SELECT statement is: SELECT pn_pricecompare_catprod.category, pn_pricecompare_catprod.asin, pn_pricecompare_product.title, pn_pricecompare_product.prod_id, pn_pricecompare

RE: Commit needed even after a select statement ??

2005-08-19 Thread Sujay Koduri
Thanks a lot Philippe. Its working. :) sujay -Original Message- From: Philippe Poelvoorde [mailto:[EMAIL PROTECTED] Sent: Friday, August 19, 2005 12:43 PM To: 'mysql@lists.mysql.com ' Subject: Re: Commit needed even after a select statement ?? HI, n(say session 2) and u

Re: Commit needed even after a select statement ??

2005-08-19 Thread Philippe Poelvoorde
HI, n(say session 2) and updated the entries in the table. Did a commit. * Now i issued the second select statement on session 1, but still it is showing the old results. Idealy it should show the new results, which are a result of updations done using session 2. But when i issue a commit

RE: Commit needed even after a select statement ??

2005-08-18 Thread Sujay Koduri
No I am performing the second select Query only. I am including the pseudo code which I am trying to do. Pseudo code Establish a connection to DB Get statement handler While(conditon) { Prepare a select statement. Bind input variable. Execute the statement. Bind o/p vars. Fetch results. Wait

Re: Commit needed even after a select statement ??

2005-08-18 Thread Jasper Bryant-Greene
Sujay Koduri wrote: hi, i am using MysQL4.1.13. I tried doing the following. * Open a new session to DB. (Say session 1) * Using prepared statements provided by C API, issued a select statement to get some rows from a table. * This worked absolutely fine. * I didnt

Commit needed even after a select statement ??

2005-08-18 Thread Sujay Koduri
hi, i am using MysQL4.1.13. I tried doing the following. * Open a new session to DB. (Say session 1) * Using prepared statements provided by C API, issued a select statement to get some rows from a table. * This worked absolutely fine. * I didnt close the session, but

Re: Call a function from a select statement?

2005-05-31 Thread Scott Klarenbach
; > From: Scott Klarenbach [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, May 31, 2005 10:58 AM > > To: My SQL > > Subject: Call a function from a select statement? > > > > Is this not the proper way to use a function in a select statement? > > > > SELECT >

RE: Call a function from a select statement?

2005-05-31 Thread Dathan Pattishall
age- > From: Scott Klarenbach [mailto:[EMAIL PROTECTED] > Sent: Tuesday, May 31, 2005 10:58 AM > To: My SQL > Subject: Call a function from a select statement? > > Is this not the proper way to use a function in a select statement? > > SELE

Call a function from a select statement?

2005-05-31 Thread Scott Klarenbach
Is this not the proper way to use a function in a select statement? SELECT t.field1, t.field2, functionPerformAdditionalQueryFromField(t.field2) AS 'customField' FROM Table t I'd like to perform the function on every row in the result set, and store the returned value of that f

RE: using if in select statement

2005-04-29 Thread mathias fatene
#x27;mysql@lists.mysql.com ' Subject: re: using if in select statement -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 My boss and I were playing with using select statements, and we can actually execute subqueries as an option if the result is true or false. Is this expected behavior, or is it something th

re: using if in select statement

2005-04-28 Thread James Black
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 My boss and I were playing with using select statements, and we can actually execute subqueries as an option if the result is true or false. Is this expected behavior, or is it something that may be fixed in a revision, before I begin to depend on it

INSERT ... SELECT statement

2005-01-21 Thread Stefano Giorgetti
I need to execute an INSERT...SELECT query. INSERT HIGH_PRIORITY INTO stations_data (station_id, Tmin, Tmax, Tmed, RHmin, RHmax, RHmed, rain, Wmax, slpres, insertion_date) ( SELECT stations.station_id AS stId, min(stations_rt_data.T) AS tmax,

Re: Select Statement Query

2004-11-09 Thread Michael Stassen
How about SELECT * FROM queLog WHERE accessed = "Y" AND targetApp = "acadreg" AND enteredQue >= '2004-11-09 18:00:00'; (You said greater than first, then you said greater than or equal to. I went with the latter.) Michael Kory Wheatley wrote: I'm

Select Statement Query

2004-11-09 Thread Kory Wheatley
I'm trying to do a select statement where: field "targetApp" equals the value "acadreg" and field accessed equals the value "Y" and filed enteredQue is like "2004-11-09 18%" the whole "enterqueue" fieild is something like "2004-11

  1   2   3   4   >