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
] Sent: lundi 25 avril 2005 21:01 To: mysql@lists.mysql.com Subject: Query question 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

RE: Query question

2005-04-25 Thread SGreen
*This not an official mysql support answer -Original Message- From: Jeff McKeon [mailto:[EMAIL PROTECTED] Sent: lundi 25 avril 2005 21:01 To: mysql@lists.mysql.com Subject: Query question I have a table that contains records that link back to a main talbe in a many to one

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

Query question

2005-04-07 Thread Ed Lazor
Three tables like this: -- product_lines -- id title -- manufacturer -- id title -- manufacturer_product_line_index -- id product_line_id manufacturer_id The index provides a one to many relationship - one product line

RE: Query question

2005-04-07 Thread Jon Wagoner
To: mysql@lists.mysql.com Subject: Query question Three tables like this: -- product_lines -- id title -- manufacturer -- id title -- manufacturer_product_line_index -- id product_line_id manufacturer_id The index provides

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: Newbie: MYSQL nested query question

2005-04-05 Thread SGreen
Just turn your subquery into another join SELECT C2.City, N.Distance FROM Cities C INNER JOIN Nbc N ON C.CityID = N.PrimaryCityID INNER JOIN Cities C2 ON C2.cityID = N.CityID WHERE C.City = 'Los Angeles' AND N.Distance 20 Shawn Green Database Administrator Unimin Corporation - Spruce Pine

Re: Newbie: MYSQL nested query question

2005-04-01 Thread Graham Anderson
I upgraded my local mysql version to 4.1.10a and the below query finally works :) How can I now amend the query so it works on my remote server running mysql 3.23.58 ? From one headache to another ;) SELECT ( SELECT City FROM Cities WHERE CityID = N.CityID ), N.Distance FROM Cities C JOIN Nbc

Re: Newbie: MYSQL nested query question

2005-04-01 Thread Peter Brawley
What was wrong with Graham's simpler query? PB - Graham Anderson wrote: I upgraded my local mysql version to 4.1.10a and the below query finally works :) How can I now amend the query so it works on my remote server running mysql 3.23.58 ? From one headache to another ;) SELECT ( SELECT

Re: Newbie: MYSQL nested query question

2005-04-01 Thread Graham Anderson
In the simple query... the city field showed the result 'Los Angeles' in every row the distance field showed incorrect results to :( City| Distance Los Angeles 18 Los Angeles 5 Los Angeles 7 ... On Apr 1, 2005, at 1:59 PM, Peter

Re: Newbie: MYSQL nested query question

2005-04-01 Thread Graham Anderson
strangely, the query works intermittently :( SELECT ( SELECT City FROM Cities WHERE CityId = N.CityId ), N.Distance FROM Cities C JOIN Nbc N ON C.CityId = N.PrimaryCityId WHERE C.City = 'Los Angeles' AND N.Distance 20 sometimes it works...other times it gives the mysql query error: show keys from

Newbie: MYSQL nested query question

2005-03-31 Thread Graham Anderson
What is the proper way to say this ? SELECT C.City, N.Distance FROM Cities C JOIN Nearbycities N ON C.CityId = N.PrimaryCityId WHERE N.CityId = (SELECT Cities.CityId FROM Cities WHERE Cities.city = 'Los Angeles') AND N.distance 20 I am trying to enter in a city and get all the nearby cites with

Re: Newbie: MYSQL nested query question

2005-03-31 Thread Philip M. Gollucci
Graham Anderson wrote: What is the proper way to say this ? SELECT C.City, N.Distance FROM Cities C JOIN Nearbycities N ON C.CityId =ci N.PrimaryCityId WHERE N.CityId = (SELECT Cities.CityId FROM Cities WHERE Cities.city = 'Los Angeles') AND N.distance 20 I am trying to enter in a city and get

Query question

2005-03-29 Thread Jerry Swanson
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 admin with adin.user_id = user.id , than I need at least all records from

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

Sub Query question

2005-02-10 Thread Daniel Rossi
Hi there, I was wondering if its possible to be able to send a field from the outer table to be used as the where statement for the sub query ? something like this select somefield from table 1, (select count(*) from table2 inner join table1 using somekey where table1.key=somefield) as alias

Query question

2005-02-01 Thread Joachim Klöfers
Hi, all I hope somebody can help me. Situation Three tables 1. ++++ | id | name | region | ++++ | 13 | Name1 | 1 | | 15 | Name2 | 2 | | 47 | Name3 | 1 | | 57 | Name4 | 2 | | 65 | Name5 | 2 | |

Best Query Question

2005-01-14 Thread Steven Weintraut
This has to be so simple, but my solution runs much slower than I would expect it to. I'm wondering if there is a more efficient way to do this type of query. I have a table of email messages, I have another table containing all of the email addresses linked to each email message I want to

Re: Calculating User Ranks (SQL Query Question)

2004-12-24 Thread Don Read
On 22-Dec-2004 Michael J. Pawlowsky wrote: I’m trying to come up with a more efficient method to do this. I have a table where people enter some info into the table. snip I would like to allow the users to be able to see where they stand rank wise with everyone else. Right now I

Query question

2004-12-23 Thread Ed Lazor
I use a table to log what pages on the website are getting visits with a table structure like this: ID DateAdded URL Now I'm trying to query the database to see which URLs are most popular, but I'm not sure how to go about doing this. Any ideas? Thanks, Ed -- MySQL General Mailing List

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
, December 23, 2004 1:46 PM To: 'mysql' Subject: Query question I use a table to log what pages on the website are getting visits with a table structure like this: ID DateAdded URL Now I'm trying to query the database to see which URLs are most popular, but I'm not sure how to go about doing this. Any

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

Calculating User Ranks (SQL Query Question)

2004-12-22 Thread Michael J. Pawlowsky
Im trying to come up with a more efficient method to do this. I have a table where people enter some info into the table. The more entries they add the more points they get. (1 point per entry). I would like to allow the users to be able to see where they stand rank wise with everyone else. Right

Re: Calculating User Ranks (SQL Query Question)

2004-12-22 Thread SGreen
Try this: CREATE TEMPORARY TABLE tmpRankings ( Rank int auto_increment, entries int, user_id int ) INSERT tmpRankings (points, user_id) SELECT count(1), user_id FROM sometablenamehere GROUP BY user_id ORDER BY entries DESC; This way the tmpRankings table contains an

General query question

2004-12-14 Thread A Z
Hi, Mysql 4.0.14 In a seconrio, some reocrds are missing from a child table. If we run this query it returns the missing records: select a.field1, b.field2 from table1 a left join table2 b on (a.field1 = b.field1) where b.field1 is null I want to create entries in the child table (table2)

Re: General query question

2004-12-13 Thread Jigal van Hemert
I want to create entries in the child table (table2) for the missing records. In table2 the primary key is of type Integer, for each new entry it should be Max(table2.PrimaryKeyfield) + 1. Why not make the primary key in table2 autoincrement? If you have an autoincrement field as primary

Re: General query question

2004-12-13 Thread A Z
Thanks, I did think of it but not having the option as this is linked to executables, which I'm sure have some sorts of calculation for this field to calculate the next value. regards --- Jigal van Hemert [EMAIL PROTECTED] wrote: I want to create entries in the child table (table2) for

Query question

2004-11-16 Thread Stuart Felenstein
I have a query statement set up for record returns based on various where statements. The select statement consists of a number of joins. One of those joins includes a field that is marked no null. Recently I did a mass insertion into the table. Into this particular no null field were place 0's

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:[SOLVED] Query question

2004-11-16 Thread Stuart Felenstein
--- Brent Baisley [EMAIL PROTECTED] wrote: 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

Simple query question

2004-09-20 Thread 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 is anything. It seems simple,

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 is

Query Question

2004-09-05 Thread Stuart Felenstein
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 is inserted and that

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

SQL Query Question

2004-08-14 Thread Michael J. Pawlowsky
Im not sure if this is possible or not. I have a Sales leads table. Part of the table has 2 employee_ids. 1. The Sales person the lead is assigned to. 2. The Marketing person that generated the lead. Then there is a employee table that has ids and names. When generating a report for leads I would

Re: SQL Query Question

2004-08-14 Thread Michael Stassen
You need to join the employee table twice, once for each id lookup, like this: SELECT es.name AS sales_name, em.name AS marketing_name, leads.id FROM leads JOIN employee es ON leads.salesid = es.id JOIN employee em ON leads.marketingid = em.id; Michael Michael J. Pawlowsky wrote:

Re: SQL Query Question

2004-08-14 Thread Michael J. Pawlowsky
Thanks a lot Michael. A regular join did not seem to work. But when I tried a LEFT JOIN it worked. A cut down example of it is the following. SELECT global_lead.id, rep_no, es.fname as sales_name, em.fname as marketing_name FROM global_lead LEFT JOIN global_employee es ON global_lead.rep_no =

Re: SQL Query Question

2004-08-14 Thread Michael Stassen
Right. If the employee ID in either the rep_no or entered_by columns does not have a corresponding row in the global_employee table, then the regular join won't match that row. In that case, as you found, you need a LEFT JOIN, which guarantees you get the rows from the table on the left, and

Re: update query question

2004-07-07 Thread SGreen
to: | | Subject: update query question

RE: update query question

2004-07-07 Thread Chris W. Parker
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] on Wednesday, July 07, 2004 11:08 AM said: Have you tried this other way of making an inner join? no i did not because i did know you could do a JOIN on an UPDATE. thanks for your suggestions i will try them out. chris. -- MySQL General Mailing

update query question

2004-07-06 Thread Chris W. Parker
hello, i've had to change some of the tables in my db to accomodate some greater flexibility in the application that uses it and because of this i need to go through and update all the records. i've done one table by hand and it had about 100 records and took about 20 minutes. but this next table

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

Query question

2004-05-24 Thread John Nichel
Hi, I have a table which I want to select data from (obiviously). In this table, I have a field which is an integer, and defaults to 0. What I would like to do is count all rows in that table which not only equals 0 for the field, but has a distinct value which is greater than 0. id

Re: Query question

2004-05-24 Thread mos
At 12:36 PM 5/24/2004, you wrote: Hi, I have a table which I want to select data from (obiviously). In this table, I have a field which is an integer, and defaults to 0. What I would like to do is count all rows in that table which not only equals 0 for the field, but has a distinct value

Re: Query question

2004-05-24 Thread John Nichel
Rich Allen wrote: iH this should work test select * from xt; ++---+ | id | field | ++---+ | 1 | 0 | | 2 | 0 | | 3 | 7 | | 4 | 8 | | 5 | 7 | | 6 | 0 | | 7 | 6 | | 8 | 7 | | 9 | 8 | ++---+ 9 rows in set (0.00 sec) test select

RE: Query question

2004-05-24 Thread Laercio Xisto Braga Cavalcanti
You can do: Select count(distinct(field)) from table where field 0 Laercio. -Original Message- From: John Nichel [mailto:[EMAIL PROTECTED] Sent: segunda-feira, 24 de maio de 2004 14:37 To: MySQL List Subject: Query question Hi, I have a table which I want to select data from

Re: Query question

2004-05-24 Thread Garth Webb
On Mon, 2004-05-24 at 11:32, John Nichel wrote: Rich Allen wrote: iH this should work test select * from xt; ++---+ | id | field | ++---+ | 1 | 0 | | 2 | 0 | | 3 | 7 | | 4 | 8 | | 5 | 7 | | 6 | 0 | | 7 | 6 | | 8

Re: Query question

2004-05-24 Thread Rich Allen
Garth, good catch! - hcir mysql - hcir On May 24, 2004, at 1:05 PM, Garth Webb wrote: On Mon, 2004-05-24 at 11:32, John Nichel wrote: Rich Allen wrote: iH this should work test select * from xt; ++---+ | id | field | ++---+ | 1 | 0 | | 2 | 0 | | 3 | 7 | | 4 | 8

Re: Query question

2004-05-24 Thread Rich Allen
iH this should work test select * from xt; ++---+ | id | field | ++---+ | 1 | 0 | | 2 | 0 | | 3 | 7 | | 4 | 8 | | 5 | 7 | | 6 | 0 | | 7 | 6 | | 8 | 7 | | 9 | 8 | ++---+ 9 rows in set (0.00 sec) test select count(distinct(field))

RE: Query question

2004-05-24 Thread Lopez David E-r9374c
John Try select field, count(*) from db.table group by field; David -Original Message- From: John Nichel [mailto:[EMAIL PROTECTED] Sent: Monday, May 24, 2004 10:37 AM To: MySQL List Subject: Query question Hi, I have a table which I want to select data from

Query question

2004-04-21 Thread Alex croes
I'm trying to select specified data from a field in a table. The field from which the data has to come contains the following: 'something;else;anything;everything;name;my' (and so on), it's a long text. I need in the case just 'my' from the field, thus between the ';'. This time there are only

Re: Query question

2004-04-21 Thread Don Read
On 21-Apr-2004 Alex croes wrote: I'm trying to select specified data from a field in a table. The field from which the data has to come contains the following: 'something;else;anything;everything;name;my' (and so on), it's a long text. I need in the case just 'my' from the field, thus

Re: Slow Query Question - Need help of Gurus.

2004-04-19 Thread Michael Stassen
Ben Dinnerville wrote: You have a redundant clause in your query - the distinct is not needed when you are doing a group by on the same field ('Call Svr Tag ID') - not sure how the optimiser in MySQL will handle this. In some RDBMS's the duplicate clause will be optimised down to 1 clause, so you

RE: Slow Query Question - Need help of Gurus.

2004-04-19 Thread Ben Dinnerville
The indexes were listed at the bottom of the original post. Woops, didnt see that far down, should have scrolled a little further :) What is needed, I expect, is a multi-column index on those 2 columns: ALTER TABLE 31909_859552 ADD INDEX Tag_Created (`Call Svc Tag ID`, `Journal Create

Re: Slow Query Question - Need help of Gurus.

2004-04-19 Thread Matt W
Ben, - Original Message - From: Ben Dinnerville Sent: Monday, April 19, 2004 1:49 AM Subject: RE: Slow Query Question - Need help of Gurus. snip Then try again: SELECT `Call Svc Tag ID`, Count(*) as counter, `Journal Create Date` FROM 31909_859552 WHERE

Re: Slow Query Question - Need help of Gurus.

2004-04-19 Thread Michael Stassen
Ben Dinnerville wrote: snip Note that sorting by the count can't use an index, so it will be slower than if you had ordered by `Call Svc Tag ID`. This is something that will need testing. Ordering on a varchar(255) column (call svc tag ID) is going to be a lot more inefficient than ordering on

RE: Slow Query Question - Need help of Gurus.

2004-04-18 Thread Ben Dinnerville
]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Slow Query Question - Need help of Gurus. Importance: High Hi All, I have a huge Database which contains about 500,000 records, (will be adding about 20-25k records every week) I need to run group queries and output the same to a web interface

very simple query question

2004-04-17 Thread Randy Paries
Hello i have a simple query select u.*,p.* from users u, profiles p where u.uname = p.uname and u.level != 0 Is there any tricks to make this use an index. If i do level=0 is uses an index , but != does not. -- MySQL General Mailing List For list archives:

RE: SQL Query Question

2004-04-17 Thread Victor Pendleton
The you will need to use the second format. DATE_FORMAT(queue_time, '%Y%m%d') = CURRENT_DATE() -Original Message- From: Dirk Bremer (NISC) To: [EMAIL PROTECTED] Sent: 4/16/04 4:09 PM Subject: Re: SQL Query Question - Original Message - From: Victor Pendleton [EMAIL PROTECTED

Re: very simple query question

2004-04-17 Thread Jigal van Hemert
i have a simple query select u.*,p.* from users u, profiles p where u.uname = p.uname and u.level != 0 Is there any tricks to make this use an index. If i do level=0 is uses an index , but != does not. MySQL only uses an index if it will return less than approx. 30% of the records. It

Re: SQL Query Question

2004-04-17 Thread Michael Stassen
If you do any math on your column, no index on the column can be used. If possible, you should always try to write your condition so that the calculations are done on the value(s) to compare to, not on the column. So, assuming you have no rows with future timestamps, something like this

Slow Query Question - Need help of Gurus.

2004-04-17 Thread Amit_Wadhwa
Hi All, I have a huge Database which contains about 500,000 records, (will be adding about 20-25k records every week) I need to run group queries and output the same to a web interface. An example is: SELECT DISTINCT(`Call Svc Tag ID`),Count(`Call Svc Tag ID`) as counter, `Journal Create Date`

SQL Query Question

2004-04-16 Thread Dirk Bremer \(NISC\)
I have a simple table where one of the columns is named queue_time and is defined as a timestamp-type. I would like to query this table for all rows where the queue_time equals the current date. I an a newbie and have been wrestling with the docs for a solution. You help will be appreciated. Dirk

RE: SQL Query Question

2004-04-16 Thread Scott Purcell
Query Question I have a simple table where one of the columns is named queue_time and is defined as a timestamp-type. I would like to query this table for all rows where the queue_time equals the current date. I an a newbie and have been wrestling with the docs for a solution. You help

RE: SQL Query Question

2004-04-16 Thread Victor Pendleton
WHERE queue_time = Now() + 0 Are you wanting just the date or the datetime? -Original Message- From: Dirk Bremer (NISC) To: [EMAIL PROTECTED] Sent: 4/16/04 2:54 PM Subject: SQL Query Question I have a simple table where one of the columns is named queue_time and is defined as a timestamp

Re: SQL Query Question

2004-04-16 Thread Dirk Bremer \(NISC\)
- Original Message - From: Victor Pendleton [EMAIL PROTECTED] To: 'Dirk Bremer (NISC) ' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, April 16, 2004 15:06 Subject: RE: SQL Query Question WHERE queue_time = Now() + 0 Are you wanting just the date or the datetime? -Original

RE: SQL Query Question

2004-04-16 Thread Victor Pendleton
%m%d') = CURRENT_DATE() + 0 ...no index usage though -Original Message- From: Dirk Bremer (NISC) To: [EMAIL PROTECTED] Sent: 4/16/04 3:25 PM Subject: Re: SQL Query Question - Original Message - From: Victor Pendleton [EMAIL PROTECTED] To: 'Dirk Bremer (NISC) ' [EMAIL PROTECTED

Re: SQL Query Question

2004-04-16 Thread Dirk Bremer \(NISC\)
- Original Message - From: Victor Pendleton [EMAIL PROTECTED] To: 'Dirk Bremer (NISC) ' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, April 16, 2004 15:57 Subject: RE: SQL Query Question If your data is stored in the following format 2004-04-16 00:00:00 you can do WHERE

Re: SQL Query Question

2004-04-16 Thread Garth Webb
On Fri, 2004-04-16 at 14:09, Dirk Bremer (NISC) wrote: - Original Message - From: Victor Pendleton [EMAIL PROTECTED] To: 'Dirk Bremer (NISC) ' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, April 16, 2004 15:57 Subject: RE: SQL Query Question If your data is stored

Query Question

2004-04-15 Thread MYSQL
Hi, I am wondering if this is possible: Say I have a table with 2 columns, Column_Count and Column_TotalCount; Is it possible to use a query to select all rows from the table where Column_Count is greater than Column_TotalCount? Like this: SELECT * FROM mytable WHERE Column_Count

Re: Query Question

2004-04-15 Thread Richard Davey
Hello, Friday, April 16, 2004, 12:50:21 AM, you wrote: M Is it possible to use a query to select all rows from the table M where Column_Count is greater than Column_TotalCount? M Like this: M SELECT * FROM mytable WHERE Column_Count Column_TotalCount; Perhaps you ought to try it before

Re: Query Question

2004-04-15 Thread MYSQL
I did try it, and it doesn't work, I was looking for Ideas that will work. Hello, Friday, April 16, 2004, 12:50:21 AM, you wrote: M Is it possible to use a query to select all rows from the table M where Column_Count is greater than Column_TotalCount? M Like this: M SELECT * FROM

Re[2]: Query Question

2004-04-15 Thread Richard Davey
Hello, Friday, April 16, 2004, 12:56:32 AM, you wrote: M I did try it, and it doesn't work, I was looking for Ideas that will work. Obviously not, because that's exactly how you do it. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- MySQL General Mailing List

Re: Query Question

2004-04-15 Thread Paul DuBois
At 16:56 -0700 4/15/04, MYSQL wrote: I did try it, and it doesn't work, I was looking for Ideas that will work. Looks to me like it should work. Try this and see what you get: SELECT Column_Count, Column_TotalCount, Column_Count ColumnTotalCount FROM mytable; That'll show you what's in the

Query Question

2004-04-15 Thread B. Fongo
It should work if both columns are numerical. Say int, decimal, float, double and so on. Babs -Ursprüngliche Nachricht- Von: MYSQL [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 16. April 2004 01:50 An: mysql Betreff: Query Question Hi, I am wondering if this is possible: Say I have

Re: query question...

2004-03-17 Thread Michael Stassen
Manuele wrote: This might sound silly to many... so sorry in advance... in mysql4 Suppose I have 2 tables: tableA has 3 columns, 2 of them reference the same column of tableB Example: TableA (Items) Id - FirstType - SecondType 0 - 1 - NULL 1 - 2 - 3

Re: query question using REGEXP

2004-03-17 Thread Michael Stassen
(',', Column, ',') LIKE '%,2,%' to search for rows that contain 2. Hope that helps. Matt - Original Message - From: award Sent: Saturday, March 13, 2004 2:16 PM Subject: query question using REGEXP Hi, I'm storing in a database numbers separated by comma if more than one number i.e Record

Re: Great QUERY question

2004-03-16 Thread Victoria Reznichenko
JR Bullington [EMAIL PROTECTED] wrote: This is for those who love a challenge. I am trying to come up with a query that would calculate the Standard Deviation and Variance for 15 fields. Although in theory this is easily done in Access, MySQL does not have the same mathematical calculations

Great QUERY question

2004-03-15 Thread JR Bullington
This is for those who love a challenge. I am trying to come up with a query that would calculate the Standard Deviation and Variance for 15 fields. Although in theory this is easily done in Access, MySQL does not have the same mathematical calculations that Access/SQL does. Here is the query as

query question...

2004-03-13 Thread Manuele
This might sound silly to many... so sorry in advance... in mysql4 Suppose I have 2 tables: tableA has 3 columns, 2 of them reference the same column of tableB Example: TableA (Items) Id - FirstType - SecondType 0 - 1 - NULL 1 - 2 - 3 TableB (Types) Id

<    1   2   3   4   5   >