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 needed for this sol.

2007-04-09 Thread Brent Baisley
Not sure how to do it in a single query, but if you run this query repeatedly, eventually you'll have only 10 left of each category. DELETE tableName FROM tableName, (SELECT MAX(ID) deleteID,count(ID) categCount FROM tableName GROUP BY Category HAVING categCount10) AS Smry WHERE

Re: Query needed for this sol.

2007-04-09 Thread Baron Schwartz
Hi Abhishek, In a table i have 100s of rows with six categories like A,B,C,D,E,F which is marked with a column like Table ID Category 1 A 2 A 3 B 4 B 5 B 6 C 7 C and so on 100 ids for each of six categories , i want to delete all but 10 ids of each category, i wanted to know how to

RE: Query to return Multiple values in a field?

2007-04-06 Thread Jerry Schwartz
I'm not sure this will work for you, but look at the GROUP BY clause and the GROUP_CONCAT() function. Regards, Jerry Schwartz Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 -Original Message- From: Jesse [mailto:[EMAIL

Re: Query to return Multiple values in a field?

2007-04-06 Thread Jesse
I'm not sure this will work for you, but look at the GROUP BY clause and the GROUP_CONCAT() function. That was exactly what I needed! I converted my query as follows, and I'm getting exactly what I was looking for: SELECT S.*, CONCAT(C.FirstName,' ',C.LastName) AS CounselorName, (SELECT

Re: Query Two Databases

2007-02-13 Thread Neil Tompkins
At the moment we are using mysql 3.23.58. It would appear I can't use UNION in this version ? Do I have any other options, without upgrading the database server version ? Regards, Neil From: Nils Jünemann [EMAIL PROTECTED] To: mysql@lists.mysql.com Subject: Re: Query Two Databases Date

Re: Query Two Databases

2007-02-13 Thread Neil Tompkins
. It would appear I can't use UNION in this version ? Do I have any other options, without upgrading the database server version ? Regards, Neil From: Nils Jünemann [EMAIL PROTECTED] To: mysql@lists.mysql.com Subject: Re: Query Two Databases Date: Thu, 25 Jan 2007 12:01:48 +0100 -BEGIN PGP

Re: Query Two Databases

2007-02-13 Thread John Meyer
Neil Tompkins wrote: Following on from the email below, if I run the query SELECT * FROM database1.table, database2.table I get the data back, but all the data is in the same row. How can I seperate the records ? Regards Neil Barring an upgrade, it seems your best bet would be to

Re: Query Two Databases

2007-02-13 Thread Henrique Dallazuanna
? Regards, Neil From: Nils Jünemann [EMAIL PROTECTED] To: mysql@lists.mysql.com Subject: Re: Query Two Databases Date: Thu, 25 Jan 2007 12:01:48 +0100 -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Neil Tompkins schrieb: Not sure if this is possible or not. But I've two identical tables in two

Re: Query ranges

2007-02-04 Thread Felix Geerinckx
[EMAIL PROTECTED] (Jerry Jones) wrote in news:[EMAIL PROTECTED]: I am trying to do an update, where item numbers 1-9 get four 0's added to the front, 10-99 get three 0's etc. mysql HELP LPAD Name: 'LPAD' Description: Syntax: LPAD(str,len,padstr) Returns the string str, left-padded with the

Re: Query headaches

2007-01-30 Thread Nils Meyer
Hi Kim, Kim Christensen wrote: The error I get while trying executing is Unknown column 'products.product_id' in 'on clause'. Since I am selecting all columns from that table (products), I can't really see why there's a fuss about it! I'm thankful for every tip I can get, and please let me

Re: Query headaches

2007-01-30 Thread Aleksandar Bradaric
Hi, The error I get while trying executing is Unknown column 'products.product_id' in 'on clause'. Since I am selecting all columns from that table (products), I can't really see why there's a fuss about it! # SELECT products.*, manufactors.*, # IF(( # SELECT i.supplier_id FROM

Re: Query Two Databases

2007-01-25 Thread Martijn Tonies
Not sure if this is possible or not. But I've two identical tables in two different databases. Is it possible to retrieve data from the different tables in one query ? Yes, by using this notation: select * from mydatabase.mytable Martijn Tonies Database Workbench - development tool for

Re: Query Two Databases

2007-01-25 Thread Nils Jünemann
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Neil Tompkins schrieb: Not sure if this is possible or not. But I've two identical tables in two different databases. Is it possible to retrieve data from the different tables in one query ? (SELECT * FROM db1.table) UNION (SELECT * FROM

Re: Query Two Databases

2007-01-25 Thread Neil Tompkins
The databases are on the same server, however the login details for each database are different. From: Martijn Tonies [EMAIL PROTECTED] To: mysql@lists.mysql.com Subject: Re: Query Two Databases Date: Thu, 25 Jan 2007 11:56:37 +0100 Not sure if this is possible or not. But I've two

Re: Query Two Databases

2007-01-25 Thread Duncan Hill
On Thursday 25 January 2007 11:08, Neil Tompkins wrote: The databases are on the same server, however the login details for each database are different. A query executes with the credentials of the authentication used to set up the connection. If you want to query two tables simultaneously

Re: Query Two Databases

2007-01-25 Thread Martijn Tonies
The databases are on the same server, however the login details for each database are different. Hmm, I guess that the currently connected user needs to have access to both databases, how else would it get the data? Martijn Tonies Database Workbench - development tool for MySQL, and more!

RE: Query about MySQL

2007-01-22 Thread Sujay Koduri
Hi Raman, Is mysql is able to manage this huge amount of data. MySQL does manage this amount of data very easily. Can we put this much of data in single table database OR keeping the data in multiple tables is the good practice. You can keep this much amount of data in one single MySQL

Re: Query about MySQL

2007-01-22 Thread ViSolve DB Team
Hi, 1) In MySQL, the size of the table limits to the storage engine and the file system size. [minimum -default -2GB] 2) As of our understanding, keeping in multiple tables is a good practice, that too with perfect normalization. If multiple tables, table sizes are in hand, limit of file

Re: Query skips one set of records

2007-01-21 Thread Miles Thompson
At 12:14 AM 1/19/2007, Dan Nelson wrote: In the last episode (Jan 18), Miles Thompson said: The query displayed below performs flawlessly, except for these two records: 7364 M0174000250510 Invoice 2006-12-13 2006-12-13 2006-12-31 7365 M01740

Re: Query skips one set of records

2007-01-21 Thread Miles Thompson
At 03:58 AM 1/19/2007, Felix Geerinckx wrote: [EMAIL PROTECTED] (Miles Thompson) wrote in news:[EMAIL PROTECTED]: This query: SELECT member_id, member_sub_id, IF( ( monthly_cost = 10 ), ( SUM(( monthly_cost * 2.00 ) + 200 ) ), ( SUM( monthly_cost * 12.00 ) ) ) AS

Re: Query skips one set of records

2007-01-21 Thread Peter Brawley
Miles Try it yourself with table tbl (id,cost) with rows (1,10),(1,50),(2,100): SELECT id, IF( cost=10, SUM(cost*2 )+ 200, SUM(cost*12)) AS Amount FROM tbl GROUP BY id,cost; +--++ | id | Amount | +--++ |1 |320 | |2 | 1200 | +--++ SELECT id,

Re: Query skips one set of records

2007-01-21 Thread Miles Thompson
Peter (and Felix), Thank you, and I learned something today. Now I have a script that needs adjusting. The amount certainly is indeterminate. The wonder is that we were able to run with this for so long. Regards - Miles At 03:57 PM 1/21/2007, Peter Brawley wrote: Miles Try it yourself

Re: Query skips one set of records

2007-01-19 Thread Felix Geerinckx
[EMAIL PROTECTED] (Miles Thompson) wrote in news:[EMAIL PROTECTED]: This query: SELECT member_id, member_sub_id, IF( ( monthly_cost = 10 ), ( SUM(( monthly_cost * 2.00 ) + 200 ) ), ( SUM( monthly_cost * 12.00 ) ) ) AS Amount FROM subinfo WHERE

Re: Query skips one set of records

2007-01-18 Thread Dan Nelson
In the last episode (Jan 18), Miles Thompson said: The query displayed below performs flawlessly, except for these two records: 7364 M0174000250510 Invoice 2006-12-13 2006-12-13 2006-12-31 7365 M01740 002506 5 Invoice 2006-12-13

Re: query taht works on mysql4 but doesn't on mysql5?

2007-01-16 Thread Chris White
[EMAIL PROTECTED] wrote: FROM .$tn., bill_info as b LEFT JOIN shipp_info as sh ON (b.bill_id=sh.bill_id That would be the usage of multiple from's combined with a left join. Unfortunately with mysql 5 you can't do this. You're going to have to do bill_info as a left/right/inner join

Re: query taht works on mysql4 but doesn't on mysql5?

2007-01-16 Thread afan
[EMAIL PROTECTED] wrote: FROM .$tn., bill_info as b LEFT JOIN shipp_info as sh ON (b.bill_id=sh.bill_id That would be the usage of multiple from's combined with a left join. Unfortunately with mysql 5 you can't do this. You're going to have to do bill_info as a left/right/inner join

RE: query taht works on mysql4 but doesn't on mysql5?

2007-01-16 Thread Jonathan Langevin
Table3 Etc etc... But you cannot do: SELECT Field1, field2 FROM Table1, Table2 LEFT JOIN Table3 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 16, 2007 11:06 AM To: Chris White Cc: mysql@lists.mysql.com Subject: Re

Re: query taht works on mysql4 but doesn't on mysql5?

2007-01-16 Thread Ran
I have not tried, but i think this is what he meant: FROM tn t INNER JOIN bill_info b ON (b.id_b = t.id_t) LEFT JOIN shipp_info sh ON (b.bill_id=sh.bill_id) HTH, On 1/16/07, Chris White [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: FROM .$tn., bill_info as b LEFT JOIN

RE: query taht works on mysql4 but doesn't on mysql5?

2007-01-16 Thread afan
:[EMAIL PROTECTED] Sent: Tuesday, January 16, 2007 11:06 AM To: Chris White Cc: mysql@lists.mysql.com Subject: Re: query taht works on mysql4 but doesn't on mysql5? [EMAIL PROTECTED] wrote: FROM .$tn., bill_info as b LEFT JOIN shipp_info as sh ON (b.bill_id=sh.bill_id That would

Re: Query not using indexes?

2006-12-13 Thread Jay Pipes
Make sure that all joined fields are of identical types, otherwise the query executor must cast each and every join value, which may be affecting the query time... Jay Chris Boget wrote: Here is a query I'm trying to run. It doesn't look like it is overly complex and, granted, it's joining on

Re: Query not using indexes?

2006-12-13 Thread Chris Boget
Make sure that all joined fields are of identical types, otherwise the query executor must cast each and every join value, which may be affecting the query time... Can you even define fields having foreign keys to be of a different type? Anyway, taking a look at my JOIN INNER JOIN users ON

Re: query help

2006-12-12 Thread Peter Brawley
I only want to view the product per product name which has the lowest price. SELECT product_name,MIN(price) FROM tbl GROUP BY product_name; PB uYe wrote: Hi, I have a table with product_name, price field. The product name may be exist in more than one record. I only want to view the product

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: Query Cache

2006-12-06 Thread Ben Clewett
Chris, Thanks for clearing that up. You are right, I don't want the general log or the mysql shell history. I'm not happy that I can't get at the Query Cache. I am sure there are tools which MySql developers must use to test the cache. I'll have to look at the source code directories...

Re: Query Cache

2006-12-05 Thread Mohsen Pahlevanzadeh
Ben Clewett wrote: Hi Mohsen, Thanks for the reply. I'm looking in the home directory, as well as the other directories used by mysql and I can't see any files which I do not recognise. (I am UNIX so there are no hidden files.) I am also a little confuses as the Query Cache is entirely a

Re: Query Cache

2006-12-05 Thread Ben Clewett
Hi Mohsen, Thanks for the advise. On my AIX system as root, dot files not hidden. For instance my mysql home directory looks like: drwxr-xr-x 16 mysqlmysql 4096 04 Dec 20:18 . drwxr-xr-x 31 root system 4096 09 Nov 15:12 .. drwxr-xr-x 2 mysqlmysql

Re: Query Cache

2006-12-05 Thread Mohsen Pahlevanzadeh
Ben Clewett wrote: Hi Mohsen, Thanks for the advise. On my AIX system as root, dot files not hidden. For instance my mysql home directory looks like: drwxr-xr-x 16 mysqlmysql 4096 04 Dec 20:18 . drwxr-xr-x 31 root system 4096 09 Nov 15:12 .. drwxr-xr-x 2 mysql

Re: Query Cache

2006-12-05 Thread Ben Clewett
Hi Mohsen, I see, the difference between the home of mysql and the mysql home... As you asked: mysql:*:204:1::/home/mysql:/usr/bin/ksh # ls -la /home/mysql 4 -rwxr- 1 mysqlstaff 254 14 Feb 2005 .profile Regards, Ben Mohsen Pahlevanzadeh wrote: Ben Clewett wrote:

Re: Query Cache

2006-12-05 Thread Chris
Mohsen Pahlevanzadeh wrote: Ben Clewett wrote: Hi Mohsen, Thanks for the reply. I'm looking in the home directory, as well as the other directories used by mysql and I can't see any files which I do not recognise. (I am UNIX so there are no hidden files.) I am also a little confuses as

Re: Query Cache

2006-12-04 Thread Ben Clewett
Hi Mohsen, Thanks for the reply. I'm looking in the home directory, as well as the other directories used by mysql and I can't see any files which I do not recognise. (I am UNIX so there are no hidden files.) I am also a little confuses as the Query Cache is entirely a memory structure,

Re: Query Analysis Tool

2006-11-03 Thread Dan Buettner
H. I actually think this would be somewhat difficult to write, Robert. Parsing the queries would be complex enough given the different ways one can construct SQL. Also it would have to examine the cardinality of the data in each column to determine if indexing would be worthwhile vs. a

RE: Query Analysis Tool

2006-11-03 Thread Robert DiFalco
PROTECTED] Sent: Friday, November 03, 2006 1:40 PM To: Robert DiFalco Cc: mysql@lists.mysql.com Subject: Re: Query Analysis Tool H. I actually think this would be somewhat difficult to write, Robert. Parsing the queries would be complex enough given the different ways one can construct SQL

Re: Query ignoring index

2006-11-02 Thread Johan Höök
Hi Jonathon, MySQL is using the index for both queries, as the column key in the explain result says. Using index means that MySQL can find all info it needs by looking at the index only, i.e doesn't need to look into the table. See: http://dev.mysql.com/doc/refman/5.0/en/explain.html for more.

Re: Query ignoring index

2006-11-02 Thread Jonathon Wardman
Hi Johan, Thanks for that, it explains what's going on. I've added `date` to the `coords` index and that seems to have sped things up considerably. Thanks. - Jonathon Johan Höök wrote: Hi Jonathon, MySQL is using the index for both queries, as the column key in the explain result says.

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 Help plss

2006-10-11 Thread Renish
Thank u so much. It woked now! - Original Message - From: Visolve DB Team [EMAIL PROTECTED] To: Visolve DB Team [EMAIL PROTECTED]; Renish [EMAIL PROTECTED]; mysql@lists.mysql.com Sent: Tuesday, October 10, 2006 1:42 PM Subject: Re: Query Help plss Hi, Hope this link will you. http

Re: Query Help plss

2006-10-09 Thread Chris
Renish koshy wrote: Hi all, I have installed MySql 4.1 in my system. when I tried to run Mysql , I always gets this error. Could not start MySql service on a local computer Error 1067: the process terminated unexpectedly. Stop sending this message! We get the idea! The more you send it,

Re: Query Help plss

2006-10-09 Thread Renish
Xp - Original Message - From: Visolve DB Team [EMAIL PROTECTED] To: Renish koshy [EMAIL PROTECTED] Sent: Tuesday, October 10, 2006 11:42 AM Subject: Re: Query Help plss Hi, On which platform? Thanks ViSolve DB Team. - Original Message - From: Renish koshy [EMAIL PROTECTED

Re: Query Help plss

2006-10-09 Thread Visolve DB Team
@lists.mysql.com Sent: Tuesday, October 10, 2006 12:35 PM Subject: Fw: Query Help plss - Original Message - From: Renish To: mysql@lists.mysql.com ; Visolve DB Team Sent: Tuesday, October 10, 2006 12:34 PM Subject: Re: Query Help plss b) And what happend when you open

Re: Query Help plss

2006-10-09 Thread Visolve DB Team
:03 AM Subject: Re: Query Help plss Hi The .err file shows that the service is stopped Normally and no error was found. sure the service is properly shutdown. Try, a) net stop mysql mysqld-nt remove mysqld-nt install net start mysql b) Also run 'services.msc' and double click on the mysql

Re: Query missing rows in location of zip by distance

2006-09-25 Thread Jay Pipes
On Mon, 2006-09-25 at 06:09 -0700, Steffan A. Cline wrote: Basically all 6 should come up in the big query because they are within the same zip and that any other locations within the same area. They all have the same latitude and longitude but only 1 shows up. If they all have the same

Re: Query missing rows in location of zip by distance

2006-09-25 Thread Steffan A. Cline
Subject: Re: Query missing rows in location of zip by distance On Mon, 2006-09-25 at 06:09 -0700, Steffan A. Cline wrote: Basically all 6 should come up in the big query because they are within the same zip and that any other locations within the same area. They all have the same latitude

Re: Query to get count of ages

2006-09-19 Thread cnelson
But you can't get a group by from an alias. That surprises me. I tried putting the calculation of age in a subquery but that didn't work, either. And I've never quite figured out how to create a temporary table for intermediate results. There has _got_ to be a way to do this, even an

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 to get count of ages

2006-09-19 Thread Anders Lundgren
Server version: 5.0.24 This query is working OK for me. I'm using FROM_DAYS() to avoid errors due to leap years. SELECT extract(YEAR FROM from_days(datediff(curdate(), dateofbirth))) AS age, SUM(extract(YEAR FROM from_days(datediff(curdate(), birth_date AS total_age FROM

Re: Query to get count of ages

2006-09-17 Thread cnelson
If your dateOfBirth is a date field, It is. you can do this: select (substring(curdate(),1,4)-substring(dateofbirth,1,4))- (substr(curdate(),5)substr(dateofbirth,5)) as age from myTable; Thanks. That's a little more accurate (thought that doesn't quite matter in my case). But

Re: Query to get count of ages

2006-09-17 Thread Alvaro Cobo
Nelson: I have double checked my last post, and the following works: SELECT DISTINCT(FLOOR((datediff(curdate(), dateofbirth)/365))) as age, COUNT(FLOOR((datediff(curdate(), dateofbirth)/365))) AS total_age from myTable group by age Tell us if it worked for you. Regards, Alvaro On

Re: Query to get count of ages

2006-09-15 Thread Jo�o C�ndido de Souza Neto
If your dateOfBirth is a date field, you can do this: select (substring(curdate(),1,4)-substring(dateofbirth,1,4))-(substr(curdate(),5)substr(dateofbirth,5)) as age from myTable; But you can't get a group by from an alias. Hope help. [EMAIL PROTECTED] escreveu na mensagem news:[EMAIL

Re: Query to get count of ages

2006-09-15 Thread Alvaro Cobo
You could try something like this: SELECT DISTINCT(round(datediff(curdate(), dateofbirth)/365)) as age, COUNT(round(datediff(curdate(), dateofbirth)/365)) AS total_age from myTable group by age Not sure, but could work. Regards, Alvaro João Cândido de Souza Neto escribió: If your

Re: query to find duplicate rows

2006-09-13 Thread Chris
Philip Hallstrom wrote: Hi all, a though query problem for me... I have a table with 2 rows that matter: url and id If url and id are the same in 2 rows, then that's no good (bad data). I need to find all the rows that are duplicates. I can't think of how to approach the sql for this.. any

Re: query to find duplicate rows

2006-09-13 Thread Philip Hallstrom
Philip Hallstrom wrote: Hi all, a though query problem for me... I have a table with 2 rows that matter: url and id If url and id are the same in 2 rows, then that's no good (bad data). I need to find all the rows that are duplicates. I can't think of how to approach the sql for this.. any

Re: query to find duplicate rows

2006-09-13 Thread Brent Baisley
You should always have a field that is a unique id for the record (i.e. autoincrement). It makes it easier for differentiating and deleting duplicates if needed. This query only works if you have a unique id field and it will only delete one duplicate record at a time. So if you have 4 records

Re: query to find duplicate rows

2006-09-13 Thread Chris
Philip Hallstrom wrote: Philip Hallstrom wrote: Hi all, a though query problem for me... I have a table with 2 rows that matter: url and id If url and id are the same in 2 rows, then that's no good (bad data). I need to find all the rows that are duplicates. I can't think of how to approach

Re: query to find duplicate rows

2006-09-12 Thread Steve Musumeche
Select COUNT(*) as num_entries, url from table WHERE num_entries1 GROUP BY url Untested, but the concept should work for you. Steve Musumeche CIO, Internet Retail Connection [EMAIL PROTECTED] Peter Van Dijck wrote: Hi all, a though query problem for me... I have a table with 2 rows that

Re: query to find duplicate rows

2006-09-12 Thread Philip Hallstrom
Hi all, a though query problem for me... I have a table with 2 rows that matter: url and id If url and id are the same in 2 rows, then that's no good (bad data). I need to find all the rows that are duplicates. I can't think of how to approach the sql for this.. any pointers? Select

Re: query cache question

2006-08-30 Thread Jay Pipes
Could you post an example of a query you are expecting to be cached? On Wed, 2006-08-30 at 11:43 -0500, Mazur Worden, Kathy wrote: Hi, I just turned on the query cache by modifying its size and limit and restarting the server. However queries aren't being stored to it:

RE: query cache question

2006-08-30 Thread Mazur Worden, Kathy
] Sent: Wednesday, August 30, 2006 12:07 PM To: Mazur Worden, Kathy Cc: mysql@lists.mysql.com Subject: Re: query cache question Could you post an example of a query you are expecting to be cached? On Wed, 2006-08-30 at 11:43 -0500, Mazur Worden, Kathy wrote: Hi, I just turned on the query

Re: query cache question

2006-08-30 Thread Philip Hallstrom
What else would prevent queries from getting into the cache? Anything with NOW() in it or any of it's related functions... -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

RE: query cache question

2006-08-30 Thread Jay Pipes
@lists.mysql.com Subject: Re: query cache question Could you post an example of a query you are expecting to be cached? On Wed, 2006-08-30 at 11:43 -0500, Mazur Worden, Kathy wrote: Hi, I just turned on the query cache by modifying its size and limit and restarting the server. However

RE: query cache question

2006-08-30 Thread Mazur Worden, Kathy
The output of that query is: @@global.query_cache_size 10485760 Kathy Mazur Worden Prairie Area Library System -Original Message- From: Jay Pipes [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 30, 2006 12:42 PM To: Mazur Worden, Kathy Cc: mysql@lists.mysql.com Subject: RE: query

RE: query cache question

2006-08-30 Thread Jay Pipes
-Original Message- From: Jay Pipes [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 30, 2006 12:42 PM To: Mazur Worden, Kathy Cc: mysql@lists.mysql.com Subject: RE: query cache question Those queries look just fine to me. Could you output the result of the following: SELECT

RE: query cache question

2006-08-30 Thread Mazur Worden, Kathy
: Jay Pipes [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 30, 2006 2:12 PM To: Mazur Worden, Kathy Cc: mysql@lists.mysql.com Subject: RE: query cache question Please show the output of: SELECT @@global.query_cache_type; and then: SHOW GLOBAL STATUS LIKE 'Qc%'; Thanks! On Wed, 2006-08-30

RE: query cache question

2006-08-30 Thread Jay Pipes
, 2006 2:12 PM To: Mazur Worden, Kathy Cc: mysql@lists.mysql.com Subject: RE: query cache question Please show the output of: SELECT @@global.query_cache_type; and then: SHOW GLOBAL STATUS LIKE 'Qc%'; Thanks! On Wed, 2006-08-30 at 13:43 -0500, Mazur Worden, Kathy wrote

RE: query cache question

2006-08-30 Thread Mazur Worden, Kathy
Actually no, I'm not using any prepared statements. But thanks for the pointer on that. -Original Message- From: Jay Pipes [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 30, 2006 2:24 PM To: Mazur Worden, Kathy Cc: mysql@lists.mysql.com Subject: RE: query cache question Ah, I think

Re: Query takes different times for execution...

2006-08-23 Thread chris smith
On 8/23/06, Ratheesh K J [EMAIL PROTECTED] wrote: Hello all, I wanted to know why a select query takes ,say, 18 sec to execute the first time I execute it and then for every successive execution it takes, say, 10 sec. I have disabled Query Caching on the server. If its not Query Caching then

Re: Query takes different times for execution...

2006-08-23 Thread Dan Buettner
When a query goes from 18 to 10 seconds, or similar times, it is likely because of caching at the MySQL or OS/disk level, not query caching. The first time, the info had to be found on the disk and read, which is relatively slow. After that it's in memory and can be accessed more quickly in the

RE: Query takes different times for execution...

2006-08-23 Thread Jerry Schwartz
More than likely, the OS file system is caching the files that make up the tables. Regards, Jerry Schwartz Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 -Original Message- From: Ratheesh K J [mailto:[EMAIL PROTECTED] Sent:

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 needed to convert varchar to int ....sorry previous posting was incomplete

2006-08-20 Thread Chris
VenuGopal Papasani wrote: Dear all, I have a table with the following structure. ield Type CollationNullKey Default Extra Privileges Comment --- -- -- ---

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 needed

2006-08-16 Thread Michael Stassen
VenuGopal Papasani wrote: Once again i send the table data: Code Period Value c12004 22 c12005 10 c22005 15 c32005 20 c42005 15 c52005 5 c62005 30 c7

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 needed

2006-08-14 Thread VenuGopal Papasani
if it is static then it works fine.but we have lots of codes in a table which should be done similar operation.instead varifying staticly with c1,c2 can we make dynamic. On 8/14/06, Peter Lauri [EMAIL PROTECTED] wrote: SELECT SUM(IF(code='c1', code, IF(code='c2', code, 0))) - SUM(IF(code='c4',

RE: query needed

2006-08-14 Thread Peter Lauri
Not until we know the logic behind the code and how the calculations should be done. -Original Message- From: VenuGopal Papasani [mailto:[EMAIL PROTECTED] Sent: Monday, August 14, 2006 1:03 PM To: Peter Lauri; mysql@lists.mysql.com Subject: Re: query needed if it is static then it works

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

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