Re: Simple Query Question

2012-04-14 Thread Willy Mularto
Hi many thanks for the help :) On Apr 14, 2012, at 6:21 PM, Stefan Kuhn wrote: > On Saturday 14 April 2012 09:51:11 Willy Mularto wrote: >> Hi, >> Please help what is wrong with this simple query "SELECT COUNT(key_agent) >> total FROM agents_consolidated WHERE total = 180" Thanks. > You need t

Re: Simple Query Question

2012-04-14 Thread Stefan Kuhn
On Saturday 14 April 2012 09:51:11 Willy Mularto wrote: > Hi, > Please help what is wrong with this simple query "SELECT COUNT(key_agent) > total FROM agents_consolidated WHERE total = 180" Thanks. You need to use having instead of where, see the documentation. Stefan > > > > Willy Mularto > F300H

Re: Simple query takes forever

2009-12-31 Thread mos
At 08:25 AM 12/31/2009, you wrote: OK, this problem (for me at least) is becoming a dead horse which I beat daily. I was having problems, I thought, with a spatial query running ridiculously slowly. Turns out the previous non-spatial index query I was using is also running super slow for reason

Re: Simple query takes forever

2009-12-31 Thread René Fournier
Here's the table definition, in case that helps: | qs| CREATE TABLE `qs` ( `id` mediumint(8) unsigned NOT NULL auto_increment, `province` enum('BC','AB','SK','MB') collate latin1_general_ci NOT NULL, `s_ts_r_m` varchar(15) collate latin1_general_ci NOT NULL, `quartersection` varchar(3)

Re: Simple Query Question

2009-12-17 Thread Ian
Hi, Thanks, I just checked and it was a memcache that was caching the output. See I knew it was a simple solution ;) Thanks for the effort everyone and sorry for wasting time. Regards Ian 2009/12/17 Aleksandar Bradaric > Hi Ian, > > Why do you think something's wrong? Here is my test data and

Re: Simple Query Question

2009-12-17 Thread Aleksandar Bradaric
Hi Ian, Why do you think something's wrong? Here is my test data and the results of your query: --- mysql> SELECT * FROM wp_views; +-+-++---+ | blog_id | post_id | date | views | +-+-++---+ | 1 | 1 | 2009-12-16 |

Re: Simple query slow on large table

2009-08-18 Thread Perrin Harkins
On Tue, Aug 18, 2009 at 5:08 AM, Simon Kimber wrote: > I have indexes on siteid, datestamp and msgtype. > > Queries such as the following are constantly appearing in the slow > queries log: > > SELECT * FROM enquiries WHERE siteid = 59255 AND msgtype = 0 ORDER BY > datestamp DESC LIMIT 5; Read the

Re: Simple query slow on large table

2009-08-18 Thread walter harms
Simon Kimber schrieb: > Hi Everyone, > > I'm having a very simple query often take several seconds to run and > would be hugely grateful for any advice on how i might spped this up. > > The table contains around 500k rows and the structure is as follows: > > +---+--+

Re: Simple Query

2007-11-12 Thread Peter Brawley
I tried this but it is not working. I'm not very familiar with subqueries as you can see. insert into table_2 ( id, value ) values ( (select id from table_1), '1' ); insert into table_2 (id,value) select id,1 from table_1; PB Ben Wiechman wrote: I need help writing what is probably a rat

Re: simple query

2006-03-13 Thread Diego Ignacio Wald
Hope this helps: select min(ctime), max(ctime) from tbl_a where ctime != "-00-00 00:00:00" Best regards, Diego - Original Message - From: "Xiaobo Chen" <[EMAIL PROTECTED]> To: Sent: Monday, March 13, 2006 11:17 AM Subject: simple query Hi, all I have a table which has a co

Re: simple query on an indexed col in big table is extremely slow

2005-07-28 Thread Zhe Wang
Hi, Shawn, Thanks a lot for your reply. Running "analyze table" didn't help much since this table has not been updated after being built. The table has 3 single indexes. What puzzled me was that the queries against the first index were fast, only slow if against the second or third

Re: simple query on an indexed col in big table is extremely slow

2005-07-28 Thread SGreen
Zhe Wang <[EMAIL PROTECTED]> wrote on 07/28/2005 10:40:08 AM: > Hi, there, > > I am have a hard time figuring out why a simple query is extremely > slow. I would greatly appreciate if you can shed some light! > > The table is in InnoDB: > > CREATE TABLE `rps_hits` ( > `gi` int(

Re: Simple query? Is it possible?

2005-05-09 Thread Roger Baklund
Vaidas Zilionis wrote: [...] Example items are displayed 100 in page, and i display 20 pages numbers 1 ... 4[5] 6 x doomain.con/items.php?page=5 and i get all result here with limit 400,100 Yes, with PHP it would be something like this: $items_per_page = 100; $limit_clause = ((int)$page-1)*$ite

Re: Simple query question

2004-09-20 Thread Roger Baklund
* John Mistler > I have a table in which the first column is either 1 or 0. The second > column is a number between 0 and 59. I need to perform a query > that returns > entries where: > > 1. IF the first column is 1, the second column is NOT 0 > 2. IF the first column is 0, the second column i

Re: Simple query help

2003-08-30 Thread Roger Baklund
* Boris Villazon > El vie, 29-08-2003 a las 22:05, Daniel Clark escribió: > > > select value from tableName where date in (select max(date) > > > from tableName where id = 4); > > > > > > But, it doesn't work with mysql 4.0. > > > > > > Any ideas? Does anybody had this problem before? > > > > What

Re: Re: Simple query help

2003-08-30 Thread Boris Villazon
El vie, 29-08-2003 a las 22:05, Daniel Clark escribió: > > select value from tableName where date in (select max(date) from > > tableName where id = 4); > > > > But, it doesn't work with mysql 4.0. > > > > Any ideas? Does anybody had this problem before? > > What about: > > SELECT value, date > FR

Re: Simple query help

2003-08-29 Thread Daniel Clark
> select value from tableName where date in (select max(date) from > tableName where id = 4); > > But, it doesn't work with mysql 4.0. > > Any ideas? Does anybody had this problem before? What about: SELECT value, date FROM tablename WHERE id = 4 ORDER BY date ASC Just pick the first row.

Re: simple query

2003-08-26 Thread Jon Haugsand
* [EMAIL PROTECTED] > I tried the manual but cant make sense of it. How can we use > wildcards on selects? select * from phrases where ph like '%who%'; -- Jon Haugsand, [EMAIL PROTECTED] http://www.norges-bank.no -- MySQL General Mailing List For list archives: http://lists.my

Re: simple query

2003-08-26 Thread AMEVANS
I use a very good book on SQL commands that was recommended in a class I took. Its generic SQL but its helped me a great deal with MySql commands. it called "Teach Yourself SQL In 10 Minutes" by Ben Forta. Each chapter should take you about 10 minutes to read. Its a SAMS book and very inexpensiv

Re: simple query

2003-08-25 Thread Roger Baklund
* Pag > Imagine i have a table "phrases" with a field "ph" with > contents like these: > > - who was it > - who wasnt it > - no i didnt > - yes i was > - dont know who > > I want to make a SELECT that gives me only the entries that > have the word "who": >

RE: simple query

2003-08-25 Thread Allen Weeks
Try "SELECT * FROM `phrases` WHERE ph like "%who%"; The percent symbol is the wildcard character for mysql queries HTH > -Original Message- > From: Pag [mailto:[EMAIL PROTECTED] > Sent: Monday, August 25, 2003 11:08 AM > To: [EMAIL PROTECTED] > Subject: simple query > > > > >

Re: simple query

2003-03-08 Thread Paul DuBois
At 17:21 + 3/8/03, Andrew wrote: come on guys I nedsome help here! MySQL Rocks I have a set of drop downs I want to determine the dropdown menu by query? I have: mysql_connect("$DBHost", "$DBUser", "$DBPass") or die("could not connect"); mysql_select_db("$DBName"); echo ""; $res

Re: simple query turned ugly

2002-11-18 Thread Roger Baklund
* Vince LaMonica [...] > I'm currently attempting this by doing [only trying priority 1 and 2 > right now]: > > SELECT > papers.id, > a1.last_name as auth1, > a2.last_name as auth2, > papers.year > FROM > paper_authors, papers, > authors AS a1 > left join authors AS a2 ON (a2.id = paper_authors.au

Re: simple query turned ugly

2002-11-14 Thread Vince LaMonica
On Thu, 14 Nov 2002, Roger Baklund wrote: } * Vince LaMonica [snip] } > The user has created multiple author cols in the publications table } > because the order of the author matters [eg: it is better for someone to } > be an author1 than an author2 or a dreaded author5]. Some publications } > ha

RE: simple query turned ugly

2002-11-14 Thread Jon Frisby
> SELECT papers.id, > concat(a1.first_name,' ',a1.middle_name,' ',a1.last_name) > as author1, > concat(a2.first_name,' ',a2.middle_name,' ',a2.last_name) > as author2, > concat(a3.first_name,' ',a3.middle_name,' ',a3.last_name) > as author3, > concat(a4.first_name,' ',a4.middle_name,' ',

Re: simple query turned ugly

2002-11-14 Thread Roger Baklund
* Vince LaMonica [...] > The authors table has 4 cols: id [primary/smallint/autoincrement], > last_name, middle_name, first_name. > > The publications table has several cols, but the ones most important to > this question are: id [primary/smallint/autoincrement], author1 > [smallint, > foreign key

RE: simple query question

2002-09-13 Thread Iikka Meriläinen
Weaver, Walt [mailto:[EMAIL PROTECTED]] > Sent: Thursday, September 12, 2002 4:09 PM > To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED] > Subject: RE: simple query question > > > I'd use the InnoDB table type and establish a primary key/foreign key > relationship (parent-c

RE: simple query question

2002-09-13 Thread Meidling, Keith, CTR, OSD-C3I
I've seen a lot about 'InnoDB'. What is it? -Original Message- From: Weaver, Walt [mailto:[EMAIL PROTECTED]] Sent: Thursday, September 12, 2002 4:09 PM To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED] Subject: RE: simple query question I'd use the InnoDB tabl

RE: simple query question

2002-09-12 Thread Weaver, Walt
I'd use the InnoDB table type and establish a primary key/foreign key relationship (parent-child) between the two. That way referential integrity will be done for you by the database. --Walt Weaver Bozeman, Montana -Original Message- From: Chris Burger [mailto:[EMAIL PROTECTED]] Sent:

Re: Simple Query

2002-05-30 Thread Benjamin Pflugmann
Hi. Please, please always cite error message if you get any. Most time they will be instant clue to some list members and without them it is almost always the start of "guessing time". That said, it sounds as if the "another user" does not have the file privilege to access the UNIX socket (that

Re: Simple Query

2001-02-14 Thread BD
Perfect! Thanks... http://www.bustdustr.net Home Of Radio Free BD > SELECT * FROM tableA left join tableb on tablea.prod_id = tableb.prod_id > where tableb.prod_id is NULL; > > -Original Message- > From: BD [mailto:[EMAIL PROTECTED]] > Sent: Thursday, 15 February 2001 15:16 > To: [EMAIL

RE: Simple Query

2001-02-14 Thread Quentin Bennett
SELECT * FROM tableA left join tableb on tablea.prod_id = tableb.prod_id where tableb.prod_id is NULL; -Original Message- From: BD [mailto:[EMAIL PROTECTED]] Sent: Thursday, 15 February 2001 15:16 To: [EMAIL PROTECTED] Subject: Simple Query For a database cleanup project... Table A: pr