Re: How to find values which do not return any tuple in "IN" clause

2011-06-11 Thread Claudio Nanni
Sorry but my mail was in "sending state" since last night, and only now was sent. Ignore it. Claudio 2011/6/11 Claudio Nanni > Hi Fahim, > > Could you please explain better what you mean exactly? > I think the question is not very clear. > Thanks > > Claudio > On Jun 11, 2011 12:36 AM, "Fahim

Re: How to find values which do not return any tuple in "IN" clause

2011-06-11 Thread Claudio Nanni
Hi Fahim, Could you please explain better what you mean exactly? I think the question is not very clear. Thanks Claudio On Jun 11, 2011 12:36 AM, "Fahim Mohammad" wrote: > Hi > > select * from tablename where fieldname in ('aaa','bbb','ccc','ddd'); > > return only the successful hit. > > How can

Re: How to find values which do not return any tuple in "IN" clause

2011-06-10 Thread Nuno Tavares
Fahim, I was not quite sure I understood you question, but looking at what you're trying to achieve in this example, give a try to my suggestion. You have to bear in mind that you can only GROUP BY values that indeed show up in the results. That means that if ('','y') never show up, they

Re: How to find values which do not return any tuple in "IN" clause

2011-06-10 Thread Fahim Mohammad
Thank you all for prompt reply. I think there is no short cut and I may need to write nested query for doing this. The method suggested by you is not working. mysql> select * from city; +-+- +--+ | city_id | city_name| state_id | +-+- +

Re: How to find values which do not return any tuple in "IN" clause

2011-06-10 Thread Nuno Tavares
create table dim (value varchar(10), primary key(value)); insert into dim values ('aaa'),('bbb'),('ccc'),('ddd'); SELECT tablename.fieldname FROM dim LEFT JOIN tablename ON tablename.fieldname = dim WHERE tablename.fieldname IS NULL; If this is not what intended, I'd suggest you to spend a littl

Re: How to find values which do not return any tuple in "IN" clause

2011-06-10 Thread Fahim Mohammad
I am looking for those values (or count of those values) which do not resulted in a hit. Thanks Fahim On Fri, Jun 10, 2011 at 7:17 PM, Fayaz Yusuf Khan wrote: > On Saturday 11 Jun 2011 4:06:27 AM Fahim Mohammad wrote: > > select * from tablename where fieldname in ('aaa','bbb','ccc','ddd'); > >

Re: How to find values which do not return any tuple in "IN" clause

2011-06-10 Thread Fayaz Yusuf Khan
On Saturday 11 Jun 2011 4:06:27 AM Fahim Mohammad wrote: > select * from tablename where fieldname in ('aaa','bbb','ccc','ddd'); > How can I know how many out of four ('aaa','bbb','ccc','ddd') resulted in a > miss OR which values do not return any tuple. Perhaps this would be what you're looking

How to find values which do not return any tuple in "IN" clause

2011-06-10 Thread Fahim Mohammad
Hi select * from tablename where fieldname in ('aaa','bbb','ccc','ddd'); return only the successful hit. How can I know how many out of four ('aaa','bbb','ccc','ddd') resulted in a miss OR which values do not return any tuple. Thanks Fahim

Re: IN clause

2011-06-08 Thread Hal�sz S�ndor
2011/06/07 17:06 +0200, joe j WHERE (`person_name` ='Tom' AND `person_name` ='Kevin' ) This is quite wrong: it is always false. Try another operator. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?u

Re: IN clause

2011-06-07 Thread joe j
ok. here's what I am trying now. First create a table with the code below with a list of countries that have the two person names I want. CREATE TABLE `table_new` SELECT t1.country FROM `table_old` as t1 JOIN `table_old` as t2 USING(country) JOIN `table_old` as t3 USING(country) WHERE (t2.`person_n

Re: IN clause

2011-06-07 Thread joe j
Thanks, but I don't see how it will work. Am I missing something? On Tue, Jun 7, 2011 at 5:24 PM, Willy Mularto wrote: > Why not GROUP BY? > > > > On Jun 7, 2011, at 10:06 PM, joe j wrote: > >> Dear all, >> >> I wish to create a new table from a table that has  two columns >> "country" and "pers

Re: IN clause

2011-06-07 Thread Willy Mularto
Why not GROUP BY? On Jun 7, 2011, at 10:06 PM, joe j wrote: > Dear all, > > I wish to create a new table from a table that has two columns > "country" and "person_name". Thus from the table below, I'd like to > select all the records of those countries that have person names 'Tom' > and 'Kevi

IN clause

2011-06-07 Thread joe j
Dear all, I wish to create a new table from a table that has two columns "country" and "person_name". Thus from the table below, I'd like to select all the records of those countries that have person names 'Tom' and 'Kevin'. "country" "person name" US Antony US

RE: Order by "in" clause

2010-11-09 Thread Daevid Vincent
> -Original Message- > From: Joeri De Backer [mailto:fons...@gmail.com] > Sent: Tuesday, November 09, 2010 1:16 AM > To: mysql > Subject: Re: Order by "in" clause > > On Tue, Nov 9, 2010 at 10:09 AM, Mark Goodge > wrote: > > Hi, > > &

Re: Order by "in" clause

2010-11-09 Thread Joeri De Backer
On Tue, Nov 9, 2010 at 10:09 AM, Mark Goodge wrote: > Hi, > > I have a query like this: > > select id, title from product where id in (1,3,5,8,10) > > What I want it to do is return the rows in the order specified in the "in" > clause, so that this: >

Order by "in" clause

2010-11-09 Thread Mark Goodge
Hi, I have a query like this: select id, title from product where id in (1,3,5,8,10) What I want it to do is return the rows in the order specified in the "in" clause, so that this: select * from product where id in (10,3,8,5,1) will give me results in this order: +--+-

Re: Why do quotes in an IN() clause effect performance so drastically?

2009-02-18 Thread Dobromir Velev
Hi, I guess the id_file_set is an INT? The problem si most likely due to the fact you are comparing integer to string, which forces MySQL to use type conversion. For more information check http://dev.mysql.com/doc/refman/5.0/en/type-conversion.html When type conversion occurs MySQL will not be

Re: Why do quotes in an IN() clause effect performance so drastically?

2009-02-18 Thread ewen fortune
Hi David, On Wed, Feb 18, 2009 at 4:25 AM, Daevid Vincent wrote: > I'm really confused. First, I don't understand why quoting my IN() > values here caused them to run significantly slower than the non-quoted > versions... on just this simple contrived example it can be as much as > 2.2 seconds vs

Why do quotes in an IN() clause effect performance so drastically?

2009-02-17 Thread Daevid Vincent
I'm really confused. First, I don't understand why quoting my IN() values here caused them to run significantly slower than the non-quoted versions... on just this simple contrived example it can be as much as 2.2 seconds vs. 0 seconds to return on a table that has 2.5M rows. The problem I'm facin

Re: Function call reult in a WHERE-IN clause

2008-12-17 Thread ceo
Perhaps pass in a "separator" string arg, default to '' and do: GROUP_CONCAT(DISTINCT h.hostid, separator) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org

Function call reult in a WHERE-IN clause

2008-12-17 Thread Cantwell, Bryan
I have a function that I built that returns a string that is really a comma separated list of values (below). I would like to use that returned value in an IN clause in sql. : select * from hosts where hostid in (getHosts(10014)); The function: CREATE FUNCTION getUserHosts(userID BIGINT

Re: order of items in a WHERE...IN clause

2008-10-24 Thread Moon's Father
See the usage of the function named field. On Mon, Jul 28, 2008 at 8:15 PM, Mr. Shawn H. Corey <[EMAIL PROTECTED]>wrote: > On Mon, 2008-07-28 at 07:32 -0400, Gary Josack wrote: > > Andrew Martin wrote: > > > Hello, > > > > > > Is it permissible to order a clause such that the search term is the >

Re: order of items in a WHERE...IN clause

2008-07-28 Thread Mr. Shawn H. Corey
On Mon, 2008-07-28 at 07:32 -0400, Gary Josack wrote: > Andrew Martin wrote: > > Hello, > > > > Is it permissible to order a clause such that the search term is the > > first item (in the clause)? > > > > standard: > > field1 IN (123, 654, 789) > > > > in question: > > 123 IN (field1, field2, field

Re: order of items in a WHERE...IN clause

2008-07-28 Thread Gary Josack
Andrew Martin wrote: Hello, Is it permissible to order a clause such that the search term is the first item (in the clause)? standard: field1 IN (123, 654, 789) in question: 123 IN (field1, field2, field3) I am interested to know if the optimizer treats this any differently if anybody can she

order of items in a WHERE...IN clause

2008-07-28 Thread Andrew Martin
Hello, Is it permissible to order a clause such that the search term is the first item (in the clause)? standard: field1 IN (123, 654, 789) in question: 123 IN (field1, field2, field3) I am interested to know if the optimizer treats this any differently if anybody can shed any light on it (exce

Re: Like inside in clause

2006-09-14 Thread Brent Baisley
You probably want to look into using RLIKE or REGEXP. SELECT id,name FROM tabename WHERE name RLIKE '^[abc]' - Original Message - From: "Ravi Kumar." <[EMAIL PROTECTED]> To: Sent: Thursday, September 14, 2006 7:37 AM Subject: Like inside in clause Dear F

Re: Like inside in clause

2006-09-14 Thread Thomas Spahni
On Thu, 14 Sep 2006, Ravi Kumar. wrote: > Is there a way to specify wildcard inside values of an in clause. I want to > be able to do this: > > select id, name from tableName where name in ('a%', 'b%', 'c%'); > > instead of doing > &

Like inside in clause

2006-09-14 Thread Ravi Kumar.
Dear Friends, Is there a way to specify wildcard inside values of an in clause. I want to be able to do this: select id, name from tableName where name in ('a%', 'b%', 'c%'); instead of doing select id, name from tableName where name like 'a%

RE: Qyery help - pass string to stored procedure for IN clause - FIXED!

2006-03-03 Thread Price, Randall
got it working so thanks very much. Randall Price VT.SETI.IAD.MIG:Microsoft Implementation Group http://vtmig.vt.edu [EMAIL PROTECTED] (540) 231-4396 -Original Message- From: Ing. Edwin Cruz [mailto:[EMAIL PROTECTED] Sent: Thursday, March 02, 2006 3:03 PM To: Price, Randall Subject:

Qyery help - pass string to stored procedure for IN clause

2006-03-02 Thread Price, Randall
I have a SELECT query that looks similar to the following: SELECT FirstName, LastName FROM myTable WHERE LastName IN ('PRICE', 'SMITH'); What I want to do is create a stored procedure for this SELECT query similar to the following: CREATE PROCEDURE

Re: subqueries *not* using indexes for IN clause

2005-04-04 Thread Kevin A. Burton
Greg Whalin wrote: We have noticed this as well and it is really pretty shoddy. It seems that when using IN( SELECT ), they treat it as ANY() which does a full table scan. Only way we have found to get fast performance out of subqueries is to use the derived table format and join with the

Re: subqueries *not* using indexes for IN clause

2005-04-04 Thread Greg Whalin
We have noticed this as well and it is really pretty shoddy. It seems that when using IN( SELECT ), they treat it as ANY() which does a full table scan. Only way we have found to get fast performance out of subqueries is to use the derived table format and join with the derived table. But

subqueries *not* using indexes for IN clause

2005-04-04 Thread Kevin A. Burton
http://www.peerfear.org/rss/permalink/2005/04/02/BrokenMySQLSubqueries Whats up with this? As far as I can tell MySQL subqueries in 4.1.x releases are totally broken with IN clauses The major reason is that they don't use *ANY* indexes and resort to full table scans. Lets take two queries: m

Re: using IN() clause

2004-11-18 Thread Frederic Wenzel
On Wed, 17 Nov 2004 21:02:27 -0800 (PST), Mitul Bhammar <[EMAIL PROTECTED]> wrote: > The query is running fine for now. I wanted to know > how MySQL interprets and executes this query and can > it have problems in future?? Read about MySQL's query optimization here:

using IN() clause

2004-11-17 Thread Mitul Bhammar
I've a bunch of IDs fetched(around 60,000) from a DB. I'm using these IDs to fetch data from another DB having a related fields in its tables. I'm using IN clause for it. i.e. for e.g. SELECT * FROM site_users WHERE parentUserId IN (1,2,3,4) Again here parentUserId is Indexe

Re: IN clause trouble

2003-11-26 Thread Victoria Reznichenko
"Kate Porter" <[EMAIL PROTECTED]> wrote: > I am using 4.0.15 on RedHat 7.3 and ran it to a strangest problem today. > > SELECT col FROM table WHERE site_id=123; > returns a list of data. > > SELECT col FROM table WHERE site_id IN(123); > returns an empty set. > > Upon further investigation, I f

IN clause trouble

2003-11-25 Thread Kate Porter
I am using 4.0.15 on RedHat 7.3 and ran it to a strangest problem today. SELECT col FROM table WHERE site_id=123; returns a list of data. SELECT col FROM table WHERE site_id IN(123); returns an empty set. Upon further investigation, I found cases when the IN() syntax gets a smaller subset of th

Re: Joining tables using "IN (...)" clause returns duplicate rows

2002-02-04 Thread Sasha Pachev
On Monday 04 February 2002 01:12 pm, Greg Bailey wrote: > What is the real "production" version? ?If 4.0.2 can be called a > production version, I'd gladly use it on my web site; however, it > doesn't seem to indicate that on the MySQL home page. ?So if I find a > bug in 3.23.47 that was fixed a "

Re: Joining tables using "IN (...)" clause returns duplicate rows

2002-02-04 Thread Greg Bailey
I guess I'm a little confused about the MySQL versions. What is the real "production" version? If 4.0.2 can be called a production version, I'd gladly use it on my web site; however, it doesn't seem to indicate that on the MySQL home page. So if I find a bug in 3.23.47 that was fixed a "long ti

Re: Help with using IN Clause, does mysql support it???

2001-07-13 Thread Paul DuBois
ot;You have an error in your SQL syntax near select var2 >from table2" > >Does mysql support the IN clause? I'm lost without it, particular with >updates. Please help! MySQL doesn't support sub-selects. http://www.mysql.co

Help with using IN Clause, does mysql support it???

2001-07-13 Thread tysonlowery
Ok, I've been writing SQL for a few years now, but only recenlty started using Mysql. I have a website hosted at a third party that uses mysql 3.23.36 I keep getting errors when I try to run fairly straight forward queries with the IN clause like: select var1 from table1 where var1 n