Re: Query Question

2009-08-18 Thread Walter Heck - OlinData.com
Bill, if you use an order by clause in your query, the limit will pick the first 100K rows in that order. That way you can ensure that all rows will be processed in (wait for it...) order :) Cheers, Walter On Tue, Aug 18, 2009 at 18:44, Bill Arbuckle b...@arbucklellc.com wrote: I am in need

RE: Query Question

2009-08-18 Thread Gavin Towey
...@gmail.com] On Behalf Of Walter Heck - OlinData.com Sent: Tuesday, August 18, 2009 9:51 AM To: b...@arbucklellc.com Cc: mysql@lists.mysql.com Subject: Re: Query Question Bill, if you use an order by clause in your query, the limit will pick the first 100K rows in that order. That way you can

Re: Query Question

2009-08-18 Thread Martijn Tonies
To further emphasize this point: A table has no order by itself, That's not entirely true ;-) Records are stored in some kind of physical order, some DBMSses implement clustered keys, meaning that the records are stored ascending order on disk. However... and you should make no

Re: Query Question

2009-08-18 Thread Johnny Withers
It may be true that some DBMSs physically store rows in whatever order you speicfy; however, this is a MySQL list, and MySQL does not do this (InnoDB anyway). For example, take a table with 10,000,000 rows and run a simple select on it: Database changed mysql SELECT id FROM trans_item LIMIT 1\G

Re: Query Question

2009-08-18 Thread Martijn Tonies
It may be true that some DBMSs physically store rows in whatever order you speicfy; That's not what I said. however, this is a MySQL list, and MySQL does not do this (InnoDB anyway). For example, take a table with 10,000,000 rows and run a simple select on it: Database changed mysql

Re: query question...

2009-06-15 Thread Martijn Engler
It sounds to me like you want to join the two tables? http://dev.mysql.com/doc/refman/5.1/en/join.html On Mon, Jun 15, 2009 at 03:56, brucebedoug...@earthlink.net wrote: hi. i've got a situation, where i'm trying to figure out how to select an item from tblA that may/maynot be in tblB. if

Re: query question...

2009-06-15 Thread Shawn Green
Hi Bruce, bruce wrote: hi. i've got a situation, where i'm trying to figure out how to select an item from tblA that may/maynot be in tblB. if the item is only in tblA, i can easilty get a list of the items select * from tblA if the item is in tblA but not linked to tblB, i can get the

Re: Query question.

2007-10-31 Thread Joerg Bruehe
Hi Richard, Richard Reina wrote: I have a database table paycheck like this. empno, date, gross, fed_with 1234 2007-09-01 1153.85 108.26 1323 2007-09-01 461.54 83.08 1289 2007-09-01 1153.85 94.41 1234 2007-09-15 1153.85 108.26 1323 2007-09-15 491.94 87.18 1289

Re: Query question.

2007-10-31 Thread Adrian Bruce
you need to group the result sets by date, look at the manual link below: http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html Richard Reina wrote: I have a database table paycheck like this. empno, date, gross, fed_with 1234 2007-09-01 1153.85 108.26 1323 2007-09-01

Re: query question

2007-10-31 Thread Adrian Bruce
[mailto:[EMAIL PROTECTED] Sent: Tuesday, October 30, 2007 1:55 AM To: Andrey Dmitriev Cc: mysql@lists.mysql.com Subject: Re: query question Thanks.. It doesn't seem to work though.. I did verify I am on 5.0 Try lose the space after group_concat. PB Andrey Dmitriev wrote: Thanks

RE: query question

2007-10-30 Thread Andrey Dmitriev
I knew I’ve seen this error before ☺ Thanks a lot. -andrey From: Peter Brawley [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 30, 2007 1:55 AM To: Andrey Dmitriev Cc: mysql@lists.mysql.com Subject: Re: query question Thanks.. It doesn't seem to work

Re: query question

2007-10-29 Thread Baron Schwartz
Hi, Andrey Dmitriev wrote: This is kind of achievable in Oracle in either sqlplus mode, or with the use of analytical functions. Or in the worst case by writing a function. But basically I have a few tables Services, Hosts, service_names And I can have a query something like select

RE: query question

2007-10-29 Thread Andrey Dmitriev
To: Andrey Dmitriev Cc: mysql@lists.mysql.com Subject: Re: query question Hi, Andrey Dmitriev wrote: This is kind of achievable in Oracle in either sqlplus mode, or with the use of analytical functions. Or in the worst case by writing a function. But basically I have a few tables Services

Re: query question

2007-10-29 Thread Peter Brawley
mysql.group_concat does not exist -Original Message- From: Baron Schwartz [mailto:[EMAIL PROTECTED] Sent: Monday, October 29, 2007 4:00 PM To: Andrey Dmitriev Cc: mysql@lists.mysql.com Subject: Re: query question Hi, Andrey Dmitriev wrote: This is kind of achievable in Oracle in either

Re: Query question

2007-04-24 Thread Anoop kumar V
Can you post your table definitions and some sample data. Also what is the end requirement - how should the end result look like? Anoop On 4/23/07, Clyde Lewis [EMAIL PROTECTED] wrote: Guys, I have the following table that contains some information about a cars. I'm trying to write a query

Re: Query Question

2007-04-16 Thread Baron Schwartz
Hi Aaron, Aaron Clausen wrote: I have a couple of very simple tables to handle a client signin site: The client table has the following fields: client_id int(11) primary key auto_increment first_name char(90) last_name char(90) The signin table has the following fields record_id int

Re: Query Question

2007-04-12 Thread Baron Schwartz
Behrang Saeedzadeh wrote: Hi, Suppose that there are two tables book and author: book id title author_id author - od title I want a query that returns all the books, but if there are more than 3 books with the same author_id, only 3 should be returned. For example if this is

Re: Query Question

2007-04-12 Thread Baron Schwartz
Hi Behrang, Behrang Saeedzadeh wrote: Hi Baron, Thanks. That that worked great. Is it possible to insert an empty row after the books by the same author? -Behi On 4/12/07, Baron Schwartz [EMAIL PROTECTED] wrote: Behrang Saeedzadeh wrote: Hi, Suppose that there are two tables book and

Re: Query Question

2007-04-12 Thread Behrang Saeedzadeh
Hi Baron, Please remember to reply to the list so others can read and benefit from answers to your questions. Also, though I don't care tremendously one way or another, many people think it's good form to place your response after the message instead of before (I tend to follow the pattern

Re: query question...

2006-12-08 Thread Dan Buettner
Try this on for size: SELECT DISTINCT id FROM tbl WHERE id NOT IN (SELECT id FROM tbl WHERE action = 1) The subselect will only work in 4.1 and later I think. Dan On 12/8/06, bruce [EMAIL PROTECTED] wrote: hi... i'm looking at what is probably a basic question. i have a tbl with -id

Re: query question...

2006-12-08 Thread John Nichel
bruce wrote: hi... i'm looking at what is probably a basic question. i have a tbl with -id -action -status -date ie: id action statusdate 1 0 1 1 1 2 1 2 3 - 2

Re: query question...

2006-12-08 Thread Peter Bradley
Ysgrifennodd bruce: hi... i'm looking at what is probably a basic question. i have a tbl with -id -action -status -date ie: id action statusdate 1 0 1 1 1 2 1 2 3 -

RE: query question...

2006-12-08 Thread bruce
. i've tried to do a 'limit' and group, but i'm missing some thing... thanks -bruce -Original Message- From: Peter Bradley [mailto:[EMAIL PROTECTED] Sent: Friday, December 08, 2006 12:26 PM To: [EMAIL PROTECTED] Cc: mysql@lists.mysql.com Subject: Re: query question... Ysgrifennodd bruce

Re: RE: query question...

2006-12-08 Thread Dan Buettner
-bruce -Original Message- From: Peter Bradley [mailto:[EMAIL PROTECTED] Sent: Friday, December 08, 2006 12:26 PM To: [EMAIL PROTECTED] Cc: mysql@lists.mysql.com Subject: Re: query question... Ysgrifennodd bruce: hi... i'm looking at what is probably a basic question. i have a tbl

Re: query question...

2006-12-08 Thread Peter Bradley
Ysgrifennodd bruce: hi peter. thanks, the solution you gave me is close...!! snip what i really want to get is: +--+ | universityID | +--+ |2 | |3 | +--+ which would be the unique 'id's. i've tried to do a 'limit' and group, but

RE: RE: query question...

2006-12-08 Thread bruce
dan... thanks!!! like a charm.. now for the other 200 queries i'm dealing with!! -Original Message- From: Dan Buettner [mailto:[EMAIL PROTECTED] Sent: Friday, December 08, 2006 1:40 PM To: [EMAIL PROTECTED] Cc: Peter Bradley; mysql@lists.mysql.com Subject: Re: RE: query question

Re: Re: Query question

2006-10-18 Thread Erick Carballo
Dan, your suggestion is *exactly* what I needed! Furthermore, because of the use of the subquery, there is no need to join to table to itself, so the query may be simplified to: mysql SELECT distinct loc1.imageId - FROM locBridgeImageLocLevel5 as loc1 - WHERE loc1.locLevel5Id =

Re: Query question

2006-10-17 Thread Dan Buettner
Erick, maybe I'm missing something or you mistyped, but you appear to be saying this: you want 2356 and not 13128 but your last SQL query is excluding only 18302. 13128 is not mentioned in the query. Try re-running the query with 13128 instead of 18302 ? Dan On 10/17/06, Erick Carballo

Re: Query question

2006-10-17 Thread Erick Carballo
Dan, thanks for your prompt response. You are correct: I mistyped. However, if I ran the query as you suggest, I obtain the same results: mysql SELECT distinct loc1.imageId - FROM locBridgeImageLocLevel5 as loc1 - INNER JOIN - locBridgeImageLocLevel5 as loc2 USING (imageId)

Re: Re: Query question

2006-10-17 Thread Dan Buettner
I see what's happening, Erick. It's matching all the rows in loc1 and loc2 with the same image id. It *is* excluding 13128, but image id 1 is still appearing because of the rows where they match *besides* 13128. For example, 18302 and actually also 2356 since you're joining a table on itself.

Re: query question: updating between 2 tables

2006-09-19 Thread Philippe Poelvoorde
2006/9/19, Peter Van Dijck [EMAIL PROTECTED]: Hi all, trying to figure out if there is a query I can use for this, or if I have to write a php script to loop tru each row... table1: entryid int(11) itemid int(11) table2: object_id int(11) The situation is: table2.objectid is populated

Re: query question: most active user

2006-08-20 Thread Chris W
Peter Van Dijck wrote: I have a table with userid and text. Users write text. I want to find the top 5 users who have the most rows in this table. I can't seem to figure out the query.. is there a query possible to do this? Thanks! Peter SELECT Count(*) as Count, UserID FROM table GROUP

Re: query question: most active user

2006-08-20 Thread Peter Van Dijck
brilliant, that works! Thanks! On 8/20/06, Chris W [EMAIL PROTECTED] wrote: Peter Van Dijck wrote: I have a table with userid and text. Users write text. I want to find the top 5 users who have the most rows in this table. I can't seem to figure out the query.. is there a query possible

Re: query question: most active user

2006-08-20 Thread Michael Loftis
select userid,count(text) from blah group by userid; --On August 20, 2006 7:22:59 PM +0100 Peter Van Dijck [EMAIL PROTECTED] wrote: I have a table with userid and text. Users write text. I want to find the top 5 users who have the most rows in this table. I can't seem to figure out the

Re: Query Question

2006-08-15 Thread Michael Stassen
The story so far, with comments: Michael DePhillips wrote: Hi, Does anyone have a clever way of returning; a requested value with one value less than that value, and one value greater than that value with one query. For example T1 contains ID 1234 1235 1236 1238 select ID from T1

Re: Query Question

2006-08-14 Thread Dan Julson
Michael, I would think this is what you want. Select ID from T1 where ID BETWEEN (id in question - 1) and (id in question + 1) If you want distinct values, place the distinct keyword in front of ID (i.e. Select DISTINCT ID... This should do it for you. -Dan Hi, Does anyone have a clever

Re: Query Question

2006-08-14 Thread nigel wood
Michael DePhillips wrote: Hi, Does anyone have a clever way of returning; a requested value with one value less than that value, and one value greater than that value with one query. For example T1 contains ID 1234 1235 1236 1238 Assuming the id's are consecutive. You want

Re: Query Question

2006-08-14 Thread Michael DePhillips
Hi Dan, Thanks for the prompt reply, As I described it yes, you are correct, however, the id may not always be one(1) value away. So the number one needs, somehow, to be replaced with a way to get the next largest value and the previous less than value. Sorry for the lack of precision in

Re: Query Question

2006-08-14 Thread nigel wood
Michael DePhillips wrote: Hi Dan, Thanks for the prompt reply, As I described it yes, you are correct, however, the id may not always be one(1) value away. So the number one needs, somehow, to be replaced with a way to get the next largest value and the previous less than value. Sorry

Re: Query Question

2006-08-14 Thread Douglas Sims
I think this will do it, although it takes three queries. I'm assuming the id values are unique, even if there can be gaps (that's what you might get with an AUTO_INCREMENT field). If the values are not guaranteed to be unique then this may not give what you want (if there are multiple

Re: Query Question

2006-08-14 Thread Michael DePhillips
Hi Nigel, A and B...please. Perhaps a UDF could achieve my initial request...any ideas. Thanks, Michael nigel wood wrote: Michael DePhillips wrote: Hi Dan, Thanks for the prompt reply, As I described it yes, you are correct, however, the id may not always be one(1) value away. So the

Re: Query Question

2006-08-14 Thread ddevaudreuil
/2006 10:47 AM To Michael DePhillips [EMAIL PROTECTED] cc Dan Julson [EMAIL PROTECTED], mysql@lists.mysql.com Subject Re: Query Question I think this will do it, although it takes three queries. I'm assuming the id values are unique, even if there can be gaps (that's what you might get

Re: Query Question

2006-08-14 Thread Douglas Sims
Sims [EMAIL PROTECTED] 08/14/2006 10:47 AM To Michael DePhillips [EMAIL PROTECTED] cc Dan Julson [EMAIL PROTECTED], mysql@lists.mysql.com Subject Re: Query Question I think this will do it, although it takes three queries. I'm assuming the id values are unique, even if there can be gaps

Re: Query Question

2006-08-14 Thread Chris White
On Monday 14 August 2006 07:08 am, Michael DePhillips wrote: select ID from T1 where ID = 1235 and ID1235 and ID 1235 LIMIT 3 (obviously this doesn't work) I would want to return 1234 1235 1236 mysql select int_value, (int_value + 1) as value2, (int_value - 1) as value3 FROM

Re: Query question: select * from table where id in (1,2,3) order by date uses FILESORT

2006-06-20 Thread Brent Baisley
MySQL is doing a file sort on the query result. It's not sorting the entire table and it's not sorting the 40 record limit you specified. It's sorting the WHERE id IN... result. After the sort, then it will return just the first 40 records. You can throw and EXPLAIN in front of the query to see

Re: Query question: select * from table where id in (1,2,3) order by date uses FILESORT

2006-06-20 Thread Dan Buettner
I agree with Brent on what MySQL is doing ... are you seeing poor performance with this query? If so, you might evaluate whether adding an index on your 'post_date' column improves things, as MySQL may be able to sort and thus LIMIT more quickly (using index in RAM rather than reading off

Re: Query Question

2006-01-16 Thread Michael Stassen
Douglas S. Davis wrote: Hi, If the following isn't appropriate, please feel free to ignore. The program I'm referring to is written in Perl and uses a MySQL database, so I thought perhaps it would be appropriate for this list. I have a webpage that displays a user's profile by selecting

Re: Query Question

2005-10-04 Thread David Griffiths
Suppose you subscribe to a public email list that offers support on a free open source database, and you see an email where someone doesn't really provide nearly enough information to answer, what would you do? What is the algorithm you are trying to implement to get the query-output? Roy

RE: Query Question

2005-10-04 Thread Becla, Jacek
Hi, One way of doing it would be: select a.tolerance, a.Cycles as PartA, b.Cycles as PartB, c.Cycles as PartC from t as a, t as b, t as c where a.tolerance=b.tolerance and a.tolerance=c.tolerance and a.PartName='A' and b.PartName='B' and c.PartName='C'; Jacek -Original Message-

Re: Query Question

2005-10-04 Thread SGreen
Roy Harrell [EMAIL PROTECTED] wrote on 10/04/2005 03:15:33 PM: Suppose I have a simple table as follows: PartName Tolerance Cycles A 1 10 A 2 11 A 3 13 A 4 15 A 5 18 B 1 12 B 2 14 B 3 16 B 4

RE: Query Question

2005-10-04 Thread SGreen
Jacek, Your method would only work so long as each PartA, PartB, and PartC all have the same tolerance numbers. if PartA and PartB had a tolerance of 20 but PartC didn't, your query would not show just the A and B tolerances. In fact, it wouldn't show a line for Tolerance 20 at all. The only

RE: Query Question

2005-10-04 Thread Becla, Jacek
; mysql@lists.mysql.com Subject: RE: Query Question Jacek, Your method would only work so long as each PartA, PartB, and PartC all have the same tolerance numbers. if PartA and PartB had a tolerance of 20 but PartC didn't, your query would not show just the A and B tolerances

RE: Query Question

2005-10-04 Thread Roy Harrell
clearly need more input from Roy. Jacek -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 04, 2005 12:56 PM To: Becla, Jacek Cc: Roy Harrell; mysql@lists.mysql.com Subject: RE: Query Question Jacek, Your method would

Re: Query Question

2005-10-04 Thread Peter Brawley
Roy, How do I set up a query whose output would look like this: Tolerance PartA PartB PartC 1 10 12 6 2 11 14 7 3 13 16 7 4 15 16 8 5 18 17 10 One

Re: Query - question

2005-08-01 Thread Eugene Kosov
Eddie wrote: How can I join two tables looking like this? Table 1: ++---+---+ | Id | Name | Score | ++---+---+ Table 2: ++---+---+---+ | Id | Name | Score | Info | ++---+---+---+ To get output table like this: Table 2:

Re: Query Question

2005-07-16 Thread Michael Stassen
Jack Lauman wrote: I have the following query which display every Cuisine in the database sorted by the WebsiteName. How can I modify this to get a COUNT of the number of records in each Cuisine in each WebsiteName? SELECT DISTINCT Restaurant.Cuisine, RestaurantWebsites.WebsiteName FROM

Re: Query Question...

2005-07-16 Thread stipe42
Jack Lauman wrote: Given the following query, how can it be modified to return 'Cuisine'(s) that have no rows as having a count of zero and also return a SUM of COUNT(*)? SELECT w.WebsiteName, r.Cuisine, COUNT(*) FROM Restaurant r JOIN RestaurantWebsites w ON r.RestaurantID =

count(*)? was: Re: Query Question...

2005-07-16 Thread Nic Stevens
Hi , This is a little off topic but I have seen count(*) on this list afew times and it got me wondering... Is there a reason to use SELECT COUNT(*) as opposed to SELECT COUNT(column)? I have noticed that selecting count(*) versus specifying the column name executes much more slowly. I've

Re: count(*)? was: Re: Query Question...

2005-07-16 Thread stipe42
I believe the difference is that count(*) includes nulls (because it is counting the number of records), whereas count(column) only counts the records where the column being counted is not null, regardless of the total number of rows. Hmm, on a related question then if I am correct above, does

Re: count(*)? was: Re: Query Question...

2005-07-16 Thread Michael Stassen
stipe42 wrote: I believe the difference is that count(*) includes nulls (because it is counting the number of records), whereas count(column) only counts the records where the column being counted is not null, regardless of the total number of rows. Right. COUNT(*) counts rows, COUNT(col)

Re: Query Question...

2005-07-16 Thread Michael Stassen
stipe42 wrote: Jack Lauman wrote: Given the following query, how can it be modified to return 'Cuisine'(s) that have no rows as having a count of zero and also return a SUM of COUNT(*)? I'm sorry, but I'm having trouble picturing what you are doing. What is a Cuisine with no rows? I see

Re: Query Question...

2005-07-16 Thread Jack Lauman
Sorry... I was having a brain fart. (I use entries in the web.xml file to generate a dropdown list of cuisines). The field cuisine is part of the restaurant table. And it does not accept a null value. It should be split out into it's own table. I do need to get a SUM of all the values

Re: Query Question...

2005-07-16 Thread Michael Stassen
Jack Lauman wrote: Sorry... I was having a brain fart. (I use entries in the web.xml file to generate a dropdown list of cuisines). The field cuisine is part of the restaurant table. And it does not accept a null value. It should be split out into it's own table. I do need to get a SUM

RE: query question

2005-04-27 Thread mathias fatene
Hi, If i understand : select month(entryDate) as monthPart, if (amount is nul,'',day(entryDate) ) as dayPart, amount from raindata order by dayPart, monthPart Best Regards Mathias FATENE Hope that helps *This not an official mysql support answer -Original

Re: query question

2005-04-27 Thread Peter Brawley
JA, To have a SELECT statement generate a row for every day in the year, either your raindata table needs a row for every day in the year, or you need another table which has a row for every day of the year. Supposing you have such a table, call it 'calendar' with a date column named

Re: Query question

2005-04-26 Thread Martijn Tonies
If my englsih is so bad, i'll try to explain and stop this thread now. That's not what was being said. I'm not teaching, i'm answering questions. If someone wants to read docs, he (she) doesn't ask a question on the list. So if i answer, i answer the question, just the question. You want

RE: Query question

2005-04-26 Thread mathias fatene
FATENE Hope that helps *This not an official mysql support answer -Original Message- From: Martijn Tonies [mailto:[EMAIL PROTECTED] Sent: mardi 26 avril 2005 12:29 To: mysql@lists.mysql.com Subject: Re: Query question If my englsih is so bad, i'll try to explain and stop

Re: Query question

2005-04-26 Thread Chris Ramsay
Mathias There are no *bad* people on this list - different point of view, yes. Participating on this and other lists requires give AND take - taking advice as well as giving it... Participating is always going to be a two way process so just accept it, and if you can't - unsubscribe. Hope this

Re: Query question

2005-04-26 Thread mfatene
sorry Chris again, i mean in what they speak about. i try help if i can, just that. :o) Mathias Selon Chris Ramsay [EMAIL PROTECTED]: Mathias There are no *bad* people on this list - different point of view, yes. Participating on this and other lists requires give AND take - taking advice

Re: Query question

2005-04-25 Thread SGreen
Jeff McKeon [EMAIL PROTECTED] wrote on 04/25/2005 03:00:55 PM: I have a table that contains records that link back to a main talbe in a many to one configuration linked by table1.id = table2.parentid Table1 (one) Table2 (many) I want to pull the latest records from table2 for each record

RE: Query question

2005-04-25 Thread mathias fatene
Hi, You can do something like that : mysql select * from son; +--+ | a| +--+ |1 | |2 | |3 | +--+ 3 rows in set (0.02 sec) mysql select * from mother; +--+--+ | a| b| +--+--+ |1 | a| |1 | b| |2 | a| |2 | c| |3

RE: Query question

2005-04-25 Thread SGreen
mathias fatene [EMAIL PROTECTED] wrote on 04/25/2005 03:19:33 PM: Hi, You can do something like that : mysql select * from son; +--+ | a| +--+ |1 | |2 | |3 | +--+ 3 rows in set (0.02 sec) mysql select * from mother; +--+--+ | a| b|

Re: Query question

2005-04-25 Thread Peter Brawley
Jeff, Something like ... SELECT * FROM table2 AS a WHERE datestamp = ( SELECT MAX( b.datestamp ) FROM table2 AS b WHERE a.parentID = b.parentID ); PB - Jeff McKeon wrote: I have a table that contains records that link back to a main talbe in a many to one configuration linked by table1.id =

RE: Query question

2005-04-25 Thread mathias fatene
'; mysql@lists.mysql.com Subject: RE: Query question mathias fatene [EMAIL PROTECTED] wrote on 04/25/2005 03:19:33 PM: Hi, You can do something like that : mysql select * from son; +--+ | a| +--+ |1 | |2 | |3 | +--+ 3 rows in set (0.02 sec) mysql select

RE: Query question

2005-04-25 Thread Jeff McKeon
Thanks all but I don't have a mysql version high enough for subqueries. Thanks, Jeff -Original Message- From: Peter Brawley [mailto:[EMAIL PROTECTED] Sent: Monday, April 25, 2005 4:01 PM To: Jeff McKeon Cc: mysql@lists.mysql.com Subject: Re: Query question Jeff, Something

RE: Query question

2005-04-25 Thread mathias fatene
support answer -Original Message- From: Peter Brawley [mailto:[EMAIL PROTECTED] Sent: lundi 25 avril 2005 22:01 To: Jeff McKeon Cc: mysql@lists.mysql.com Subject: Re: Query question Jeff, Something like ... SELECT * FROM table2 AS a WHERE datestamp = ( SELECT MAX( b.datestamp ) FROM

Re: Query question

2005-04-25 Thread Peter Brawley
-Original Message- From: Peter Brawley [mailto:[EMAIL PROTECTED]] Sent: Monday, April 25, 2005 4:01 PM To: Jeff McKeon Cc: mysql@lists.mysql.com Subject: Re: Query question Jeff, Something like ... SELECT * FROM table2 AS a WHERE datestamp = ( SELECT MAX( b.datestamp ) FROM table2

Re: Query question

2005-04-25 Thread Peter Brawley
-Original Message- From: Peter Brawley [mailto:[EMAIL PROTECTED]] Sent: Monday, April 25, 2005 4:01 PM To: Jeff McKeon Cc: mysql@lists.mysql.com Subject: Re: Query question Jeff, Something like ... SELECT * FROM table2 AS a WHERE datestamp = ( SELECT MAX( b.datestamp ) FROM table2

RE: Query question

2005-04-25 Thread mathias fatene
Mathias FATENE Hope that helps *This not an official mysql support answer -Original Message- From: Peter Brawley [mailto:[EMAIL PROTECTED] Sent: lundi 25 avril 2005 22:17 To: Jeff McKeon Cc: mysql@lists.mysql.com Subject: Re: Query question Jeff, Then do it with 2

RE: Query question

2005-04-25 Thread Jeff McKeon
@lists.mysql.com Subject: Re: Query question Jeff, Then do it with 2 queries, SELECT @d := MAX( datestamp ) FROM table2 WHERE parentID = X; SELECT * FROM table2 WHERE parentID = X

Re: Query question

2005-04-25 Thread Peter Brawley
@lists.mysql.com Subject: Re: Query question Jeff, Then do it with 2 queries, SELECT @d := MAX( datestamp ) FROM table2 WHERE parentID = X; SELECT * FROM table2 WHERE parentID = X AND [EMAIL PROTECTED]; PB - Jeff McKeon wrote: Thanks all but I

RE: Query question

2005-04-25 Thread SGreen
: mysql@lists.mysql.com Subject: Re: Query question Jeff, Something like ... SELECT * FROM table2 AS a WHERE datestamp = ( SELECT MAX( b.datestamp ) FROM table2 AS b WHERE a.parentID = b.parentID ); PB - Jeff McKeon wrote: I have

Re: Query question

2005-04-25 Thread Peter Brawley
Jeff -Original Message- From: Peter Brawley [mailto:[EMAIL PROTECTED]] Sent: Monday, April 25, 2005 4:17 PM To: Jeff McKeon Cc: mysql@lists.mysql.com Subject: Re: Query question Jeff, Then do it with 2 queries, SELECT @d := MAX( datest

RE: Query question

2005-04-25 Thread Jeff McKeon
] Sent: Monday, April 25, 2005 4:17 PM To: Jeff McKeon Cc: mysql@lists.mysql.com Subject: Re: Query question Jeff

Re: Query question

2005-04-25 Thread Peter Brawley
this right now or i'd upgrade, believe me! jeff -Original Message- From: Peter Brawley [mailto:[EMAIL PROTECTED]] Sent: Monday, April 25, 2005 4:43 PM To: Jeff McKeon Cc: mysql@lists.mysql.com Subject: Re: Query question That's real syntax

RE: Query question

2005-04-25 Thread SGreen
mathias fatene [EMAIL PROTECTED] wrote on 04/25/2005 04:24:42 PM: Hi, Im sorry to disappoint you but this is an anti-performance solution. Use joins rathers than subqueries, and don't use joins if you can (all data in the mother table). Imagine that table2 has 30.000.000 records, and not

RE: Query question

2005-04-25 Thread Jeff McKeon
25, 2005 4:36 PM To: Jeff McKeon Cc: mysql@lists.mysql.com Subject: RE: Query question Jeff McKeon [EMAIL PROTECTED] wrote on 04/25/2005 04:08:29 PM: Thanks all but I don't have a mysql version high enough for subqueries

RE: Query question

2005-04-25 Thread mathias fatene
answer -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: lundi 25 avril 2005 23:02 To: mathias fatene Cc: 'Jeff McKeon'; mysql@lists.mysql.com; [EMAIL PROTECTED] Subject: RE: Query question mathias fatene [EMAIL PROTECTED] wrote on 04/25/2005 04:24:42 PM

RE: Query question

2005-04-07 Thread Jon Wagoner
SELECT product_lines.* FROM product_lines LEFT JOIN manufacturer_product_line_index ON manufacturer_product_line_index.product_line_id = product_lines.id WHERE product_lines.id IS NULL -Original Message- From: Ed Lazor [mailto:[EMAIL PROTECTED] Sent: Thursday, April 07, 2005 11:39 AM To:

Re: Query question

2005-04-07 Thread SGreen
Ed Lazor [EMAIL PROTECTED] wrote on 04/07/2005 12:39:01 PM: Three tables like this: -- product_lines -- id title -- manufacturer -- id title -- manufacturer_product_line_index -- id product_line_id

RE: Query question

2005-04-07 Thread Ed Lazor
Whew, thanks Jon =) -Original Message- SELECT product_lines.* FROM product_lines LEFT JOIN manufacturer_product_line_index ON manufacturer_product_line_index.product_line_id = product_lines.id WHERE product_lines.id IS NULL -- MySQL General Mailing List For list archives:

Re: Query question

2005-03-29 Thread SGreen
Jerry Swanson [EMAIL PROTECTED] wrote on 03/29/2005 11:43:56 AM: I want to get everything from user than if record exist in admin so user has admin(administrator) in table user with user.id = admin.admin_id, so I need to get 'admin' first_name and last_name If there is no record in table

Re: Query question

2004-12-23 Thread SGreen
This will return the top 50 urls in descending order of popularity. SELECT URL, count(1) as popularity FROM yourtablename GROUP BY URL ORDER BY popularity DESC LIMIT 50; Feel free to adjust as needed. HTH, Shawn Green Database Administrator Unimin Corporation - Spruce Pine Ed Lazor [EMAIL

RE: Query question

2004-12-23 Thread Dimitar Georgievski
Ed, Try the following query select ID, DateAdded, URL, count(*) as 'cnt' from mytable group by URL order by cnt desc It should display the most numerous URLs in the table. dimitar -Original Message- From: Ed Lazor [mailto:[EMAIL PROTECTED] Sent: Thursday,

RE: Query question

2004-12-23 Thread Ed Lazor
Thanks, Shawn. I didn't think count would just limit to the items being grouped - very handy =) -Ed SELECT URL, count(1) as popularity FROM yourtablename GROUP BY URL ORDER BY popularity DESC LIMIT 50; -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To

Re: Query question

2004-11-16 Thread Brent Baisley
Quite possibly since 0 could also mean false depending on your comparison operator. For instance, using a generic if statement, these two would both evaluate to false: if(0) if(null) You should be very specific when checking for NULL. WHERE field IS NOT NULL or WHERE field IS NULL Also, you may

Re: Query Question

2004-09-05 Thread Stuart Felenstein
I think I'm on the right track but still in question After all the joins I added a and LocationState = x. I'm not totally sure, because I want to search for records based on (for now)3 conditions (state, city, industry). Two things I should mention , the somewhat strange notation is becaue I'm

Re: Query Question

2004-09-05 Thread Michael Stassen
Stuart Felenstein wrote: I'm hoping I can present this correctly. I'm trying to determine how to set up my where condition as, 1 way has already failed me. While I continue to figure this out (i'm a noob), I hope asking for some advice here won't be too awful. There is one main table where data

Re: Query Question

2004-09-05 Thread Stuart Felenstein
Well I feel like maybe I wasted some bandwidth here. I think what I'm looking for is a square peg in a round hole. That won't work. More to the point :) , I do not having a problem with the AND / OR / IN / NOT / etc. What I think I was attempting was to come up with a SQL statement that will

RE: Query question

2004-05-25 Thread Amit_Wadhwa
Select count(distinct(field)) from table where field = 0 ? -Original Message- From: Laercio Xisto Braga Cavalcanti [mailto:[EMAIL PROTECTED] Sent: Monday, May 24, 2004 11:18 PM To: 'John Nichel'; 'MySQL List' Subject: RE: Query question You can do: Select count(distinct(field)) from

  1   2   >