Re: A Simple Query Help

2012-04-22 Thread Igor Shevtsov
Hi Rafael, You can try using correlated subquery instead of outer join. This can be slow with big tables though: SELECT * FROM users WHERE accept_email = 1 and email not in (SELECT email FROM sent_emails WHERE sent_emails .email = users.email AND messageID NOT LIKE = ‘XX’) OR OUTER JOIN as

A Simple Query Help

2012-04-22 Thread Rafael Ribeiro
Dear Friends, I m new on this list, and I m trying to learn more about mysql. After perform a lot of searchs in the Internet, I have no answer to my question and would like to ask your help. I wanna a perform a query that depends of the result from another (query) table inside the same

Re: What should be a simple query...

2007-09-11 Thread David Schneider-Joseph
Try this: SELECT RMAs.rma_id FROM RMAs, rma_line_items WHERE TO_DAYS(date_settled) = 733274 AND RMAs.rma_id = rma_line_items.rma_id GROUP BY RMAs.rma_id HAVING COUNT(*) > 1 On Sep 10, 2007, at 11:36 PM, Mike Mannakee wrote: I have two tables, one called RMAs and the other called rma_line_item

What should be a simple query...

2007-09-10 Thread Mike Mannakee
I have two tables, one called RMAs and the other called rma_line_items. The first one has the general details of the RMA (Return Merchandise Authorization) , the second holds the details of each item being returned. What I want is a listing of the RMA ids (which are unique in the RMAs table) w

Re: Having problems with what appears to be a simple query.

2007-01-17 Thread Daniel Smith
On Wed, 2007-01-17 at 11:47 -0600, Peter Brawley wrote: > Daniel, > > CREATE TABLE tbl ( > lab_number int(11) default NULL, > result int(11) default NULL, > release_time datetime default NULL > ); > select * from tbl; > +++-+ > | lab_number | result |

Re: Having problems with what appears to be a simple query.

2007-01-17 Thread Peter Brawley
Daniel, CREATE TABLE tbl ( lab_number int(11) default NULL, result int(11) default NULL, release_time datetime default NULL ); select * from tbl; +++-+ | lab_number | result | release_time| +++-+ |

Re: Having problems with what appears to be a simple query.

2007-01-17 Thread Daniel Smith
On Wed, 2007-01-17 at 09:56 -0600, Peter Brawley wrote: > Daniel, > > >find the lab_number where ALL the tests have been performed and > >not the lab_numbers which have partial results. > > SELECT t1.lab,t1.res,t1.dt > FROM tbl t1 > WHERE NOT EXISTS( > SELECT lab FROM tbl t2 WHERE t1.lab=t2.lab

Re: Having problems with what appears to be a simple query.

2007-01-17 Thread Peter Brawley
Daniel, find the lab_number where ALL the tests have been performed and not the lab_numbers which have partial results. SELECT t1.lab,t1.res,t1.dt FROM tbl t1 WHERE NOT EXISTS( SELECT lab FROM tbl t2 WHERE t1.lab=t2.lab AND t2.res IS NULL ); The decorrelated version uses an exclusion join, r

Having problems with what appears to be a simple query.

2007-01-17 Thread Daniel Smith
I have a table with numerous columns but needing to perform a query based on three columns: Lab_number, result, release_time. What I want to do is search for lab_number where there is a result but not released. The problem that is making this difficult for me, is that there are multiple entries

RE: Help regarding a simple query

2006-03-13 Thread Jeff
>-Original Message- >From: VenuGopal Papasani [mailto:[EMAIL PROTECTED] >Sent: Monday, March 13, 2006 11:48 >To: Jeff >Subject: Re: Help regarding a simple query > > >Hi Jeff, > This is venu again.Last mail i did not include a constraint that is what irritatin

Re: Help regarding a simple query

2006-03-13 Thread Peter Brawley
Now i need to get all the records which consists of the string venu(case should not be considered either case should be).i.e i should get 1,2,3,4,5,8 records A simple way is ...  ...   WHERE LOCATE('venu', col_name ) > 0   ... or if the column is [VAR]BINARY, LOCATE('venu',CAST(col_name

RE: Help regarding a simple query

2006-03-13 Thread Jeff
> -Original Message- > From: VenuGopal Papasani [mailto:[EMAIL PROTECTED] > Sent: Monday, March 13, 2006 10:33 > To: mysql@lists.mysql.com > Subject: Help regarding a simple query > > > Hi, > I am searching for a query where i can have pattern > ma

Help regarding a simple query

2006-03-13 Thread VenuGopal Papasani
Hi, I am searching for a query where i can have pattern matching without considering the cases.You can consider the following example for detailed description of what i want exactly. Let my table X consists of following data Name --- venu venup venugopla VenugOpal VENU pap

Re: Unclear on UPDATE versus INSERT, and a simple query that is not working

2005-09-15 Thread Dave
UPDATE forums_members,members SET forums_members.active=members.active WHERE forums_members.member_id = members.id Oh, I see. I now feel a little foolish as I should have grasped that. For some reason I assumed that by specifying where to get the data from, it would be assumed that's what t

Re: Unclear on UPDATE versus INSERT, and a simple query that is not working

2005-09-15 Thread Pooly
2005/9/15, Dave <[EMAIL PROTECTED]>: > MySQL General List, > > Server specifications: > MySQL 4.1.3-beta, phpMyAdmin 2.5.7-pl1, PHP 4.3.8 > My specifications: > MySQL beginner, PHP intermediate, HTML and CSS advanced. > > The situation: > I have two tables, one old, and one new. In bo

Unclear on UPDATE versus INSERT, and a simple query that is not working

2005-09-15 Thread Dave
MySQL General List, Server specifications: MySQL 4.1.3-beta, phpMyAdmin 2.5.7-pl1, PHP 4.3.8 My specifications: MySQL beginner, PHP intermediate, HTML and CSS advanced. The situation: I have two tables, one old, and one new. In both tables I have a column called "active", which is either

Re: how to speed up a simple query? can anyone help with an ideea?

2004-04-21 Thread Arthur Radulescu
> Creating a combined index can help MySQL in using this index for both the > where condition and the order by clause. > Try the query with an index on cat,date and with date,cat; maybe one will be > faster than the other. This partially solved my problem. Thanks a lot. However I am facing a new p

Re: how to speed up a simple query? need some help here...

2004-04-20 Thread Arthur Radulescu
> Create composite index on (cat, date). Use EXPLAIN to see if MySQL uses index: > http://dev.mysql.com/doc/mysql/en/EXPLAIN.html This partially solved my problem. Thanks a lot. However I am facing a new problem here. The query where I am ordering by a column is much more slowly than the same que

Re: how to speed up a simple query? can anyone help with an ideea?

2004-04-20 Thread Arthur Radulescu
> 1. MySQL only uses one index for each table in a JOIN; this query only uses > one table, so only one index is used. > 2. DESC is slower than ASC > 3. Try creating an index on two columns; try cat and date, and try date and > cat. > 4. Check EXPLAIN SELECT id,name.. to see whether the right in

Re: how to speed up a simple query? can anyone help with an ideea?

2004-04-20 Thread Jigal van Hemert
> select id,name,desc,cat,date from table where cat='12' > > however I need to order the results by date desc... I have indexes on both > the cat and date (of type timestamp) fields however this operation is much > more slowly when I used the order So the result is something like this > > selec

Re: how to speed up a simple query?

2004-04-20 Thread Egor Egorov
"Arthur Radulescu" <[EMAIL PROTECTED]> wrote: > > I have a simple query on a table of about 1,000,000 records... The table is > optimized and the query is pretty simple at this moment... something like > this > > select id,name,desc,cat,date from table where cat

how to speed up a simple query? can anyone help with an ideea?

2004-04-20 Thread Arthur Radulescu
Hello! I have a simple query on a table of about 1,000,000 records... The table is optimized and the query is pretty simple at this moment... something like this select id,name,desc,cat,date from table where cat='12' however I need to order the results by date desc... I have indexes o

how to speed up a simple query?

2004-04-19 Thread Arthur Radulescu
Hello! I have a simple query on a table of about 1,000,000 records... The table is optimized and the query is pretty simple at this moment... something like this select id,name,desc,cat,date from table where cat='12' however I need to order the results by date desc... I have indexes o

RE: I can't figure out what I thought would be a simple query..

2003-10-28 Thread Mike Knox
e- From: Larry Brown [mailto:[EMAIL PROTECTED] Sent: 27 October 2003 22:30 To: Jim Matzdorff; MySQL List Subject: RE: I can't figure out what I thought would be a simple query.. I'm interested to see what kind of solution is offered for this as I could use it myself. I'm having to

Re: I can't figure out what I thought would be a simple query..

2003-10-27 Thread Matt W
ike the subselect method would have this problem also. Can someone tell me if this is true or am I thinking wrong? Hmm. Hope that helps. Matt - Original Message - From: "Larry Brown" Sent: Monday, October 27, 2003 4:29 PM Subject: RE: I can't figure out what I thought w

RE: I can't figure out what I thought would be a simple query..

2003-10-27 Thread Larry Brown
PROTECTED] Subject: I can't figure out what I thought would be a simple query.. All; I am having tremendous trouble attempting to do the following query; and any help would be appreciated. I am using Mysql 4.0.15a; and I cannot upgrade. Given the following TEMPORARY table (it's a table

I can't figure out what I thought would be a simple query..

2003-10-27 Thread Jim Matzdorff
All; I am having tremendous trouble attempting to do the following query; and any help would be appreciated. I am using Mysql 4.0.15a; and I cannot upgrade. Given the following TEMPORARY table (it's a table I have created from a whole host of sources): table: endtime_table +

RE: A Simple Query!

2003-03-02 Thread Uttam
Hi Bruce, yep, u r right. Anyway, MySQL query optimizer will take care of it ;) regds, -Original Message- From: Bruce Feist [mailto:[EMAIL PROTECTED] Sent: Sunday, March 02, 2003 04:00 To: [EMAIL PROTECTED] Subject: Re: A Simple Query! Hello, Uttam; We can simplify this, actually

A Simple Query! - SOLVED

2003-03-02 Thread Remi Mikalsen
Working solution – Bruce Feist SELECT Films.idFilm, title FROM Films LEFT JOIN Loans ON (Films.idFilm = Loans.idFilm) AND (Loans.return_date IS NULL) WHERE Loans.idFilm IS NULL; Note: This solution works for me as it considers that I give no value (NULL) to the attribute return_date at th

Re: A Simple Query!

2003-03-01 Thread Bruce Feist
Hello, Uttam; We can simplify this, actually... any time L.idFilm is NULL (i.e., no row in Loans is found), L.dateReturn will have to be NULL as well. So, specifying the L.idFilm IS NULL condition is redundant. It's sufficient to look only at L.dateReturn IS NULL in the WHERE clause. Yours i

RE: A Simple Query!

2003-03-01 Thread Uttam
ch 01, 2003 08:13 To: [EMAIL PROTECTED] Subject: Re: A Simple Query! Hello, Remi; Try this; I *think* it'll work (but I'm also new to MySQL): select F.idFilm, F.title from Films F left join Loans L on F.idFilm = L.idFilm and L.dateReturn IS NULL where L.idFilm IS NULL; This provides

Re: A Simple Query!

2003-02-28 Thread Sam A. Funk
Hello, This is the way I normally do queries that would be solved with sub-selects in other products: SELECT F.idFilm, F.title FROM Films F, Loans L WHERE F.idFilm = L.idFilm AND L.dateReturn IS NULL; Sam A. Funk At 02:27 + 03/01/03, Remi Mikalsen wrote: Hello, I believe, and hope, I have a

Re: A Simple Query!

2003-02-28 Thread Bruce Feist
Hello, Remi; Try this; I *think* it'll work (but I'm also new to MySQL): select F.idFilm, F.title from Films F left join Loans L on F.idFilm = L.idFilm and L.dateReturn IS NULL where L.idFilm IS NULL; This provides an interesting example of the difference between "on" and "where", by the way; it

A Simple Query!

2003-02-28 Thread Remi Mikalsen
Hello, I believe, and hope, I have a very simple question, but as I am relatively new to MySQL I might be missing out on the obvious solution. Is it possible to use a single MySQL query (with the simple scheme presented) to ask the following question? Scheme: Films (idFilm, title) Loans (i

RE: a simple query

2002-12-14 Thread Adolfo Bello
ySQL Mailing List > Subject: a simple query > > > Hi, > > I have a table like this: > > --- > | Code | Name | ParentFemale | ParentMale | > --- > |1 | Child

a simple query

2002-12-14 Thread Fam. Tarniceru
Hi, I have a table like this: --- | Code | Name | ParentFemale | ParentMale | --- |1 | Child| 2 | 3 | --- |

Re: help with a simple query..

2002-08-02 Thread Bhavin Vyas
SELECT * from hwu_articles WHERE id = '$id' and price is not null and name is not null and ratings is not null; Bhavin. - Original Message - From: "Alex Behrens" <[EMAIL PROTECTED]> To: "MYSQL" <[EMAIL PROTECTED]> Sent: Friday, August 02, 2002

help with a simple query..

2002-08-02 Thread Alex Behrens
Hi Guys, I'm still new to this and I'm trying to get back into and I need help with a simple query. I have a list of info about a product for an article on my website and I'm pulling all this info from a mysql db and displaying it byway of php but don't know how to do the que

A lil help with a simple query...

2002-08-02 Thread Alex Behrens
Hi Guys, I'm still new to this and I'm trying to get back into and I need help with a simple query. I have a list of info about a product for an article on my website and I'm pulling all this info from a mysql db and displaying it byway of php but don't know how to do the que

Re: A simple query, please help (solved)

2002-06-14 Thread Vandana
Thanks a lot, it worked with the double datatype! On Fri, 14 Jun 2002, Michael Ivanyo wrote: > I've had similar problems with this in my career and > have come to the conclusion that one should always use > double floats. The problem is typically due to round > off errors of the float

Re: A simple query, please help

2002-06-14 Thread Gelu Gogancea
"select version();" "show create table ...;" - Original Message - From: "Vandana" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, June 14, 2002 7:01 PM Subject: A simple query, please help > > My table is as follows: &g

A simple query, please help

2002-06-14 Thread Vandana
My table is as follows: Value Distance (float) (float) 2.0 42.3 1.0 56.9 3.2 20.0 1.3 18.5 I issued a query, 'update ta

Re: Help with a simple query ..

2001-08-20 Thread David Turner
Try this. I couldn't find if MYSQL supports not in's so I followed there outer joins. You can read up on in in the mysql manual, do a search on outer joins. select base.zipcode,properties.zipcode from base right join properties on base.zipcode=properties.zipcode where base.zipcode is null; On

RE: Help with a simple query ..

2001-08-20 Thread Carsten H. Pedersen
> I have 2 tables: > > bases, and properties > > base has a ZIPCODE field in the table, as does the properties table. > > I'm trying to find all bases that do NOT have a property in that zip code. > > What I've tried is: The general answer: http://www.bitbybit.dk/mysqlfaq/faq.html#ch7_10_0 In yo

Help with a simple query ..

2001-08-20 Thread Chad Day
I have 2 tables: bases, and properties base has a ZIPCODE field in the table, as does the properties table. I'm trying to find all bases that do NOT have a property in that zip code. What I've tried is: select distinct cb.*, cp.* from classified_bases as cb left join classified_properties as