Re: Is there a better way than this?

2009-12-28 Thread Tim Molter
this verbose logic: SELECT DISTINCT X FROM A WHERE Y equals 25 and Y also does NOT equal 24. I came up with the following SQL, which gives me my desired result, but is there a better way to do it? Can it be achieved using MINUS or UNION somehow? BTW, I'm using IN here because I intend to replace

Re: Is there a better way than this?

2009-12-28 Thread Michael Dykman
-Original Message- From: Chris W [mailto:4rfv...@cox.net] Sent: Sunday, December 27, 2009 6:02 PM To: Tim Molter Cc: mysql@lists.mysql.com Subject: Re: Is there a better way than this? Unless I am missing something, this should work. SELECT DISTINCT X FROM `A` WHERE Y IN (25) AND Y

RE: Is there a better way than this?

2009-12-28 Thread Gavin Towey
Cc: mysql@lists.mysql.com Subject: Re: Is there a better way than this? Unless I am missing something, this should work. SELECT DISTINCT X FROM `A` WHERE Y IN (25) AND Y NOT IN (24) Chris W Tim Molter wrote: I'm new to MySQL and I'm looking for some guidance. I have a table A, with two

Re: Is there a better way than this?

2009-12-28 Thread DaWiz
logic: SELECT DISTINCT X FROM A WHERE Y equals 25 and Y also does NOT equal 24. I came up with the following SQL, which gives me my desired result, but is there a better way to do it? Can it be achieved using MINUS or UNION somehow? BTW, I'm using IN here because I intend to replace the single

Is there a better way than this?

2009-12-27 Thread Tim Molter
: SELECT DISTINCT X FROM A WHERE Y equals 25 and Y also does NOT equal 24. I came up with the following SQL, which gives me my desired result, but is there a better way to do it? Can it be achieved using MINUS or UNION somehow? BTW, I'm using IN here because I intend to replace the single numbers (24

Re: Is there a better way than this?

2009-12-27 Thread John List
On 12/27/2009 06:04 PM, Tim Molter wrote: I'm new to MySQL and I'm looking for some guidance. I have a table A, with two columns X and Y with the following data: | X|Y| 1 24 1 25 2 25 2 26 3 27 I want my SQL query

Re: Is there a better way than this?

2009-12-27 Thread Chris W
, but is there a better way to do it? Can it be achieved using MINUS or UNION somehow? BTW, I'm using IN here because I intend to replace the single numbers (24 and 25) with arrays that have 0 to N members. SELECT DISTINCT X FROM `A` WHERE X IN ( SELECT X FROM `A` WHERE Y IN (25) ) AND X NOT IN ( SELECT X FROM

AW: Re: a better way, code technique?

2009-09-04 Thread Majk.Skoric
-Ursprüngliche Nachricht- Von: Per Jessen [mailto:p...@computer.org] Gesendet: Freitag, 4. September 2009 13:05 An: mysql@lists.mysql.com Betreff: Re: a better way, code technique? AndrewJames wrote: is there a better way (hopefully simpler) to code this? i want to get the user id

Re: AW: Re: a better way, code technique?

2009-09-04 Thread AndrewJames
hahah thank-you, love the responses here. you guys are awesome.. ps, where does the %s come from? -- From: majk.sko...@eventim.de Sent: Friday, September 04, 2009 9:11 PM To: p...@computer.org; mysql@lists.mysql.com Subject: AW: Re: a better way

AW: AW: Re: a better way, code technique?

2009-09-04 Thread Majk.Skoric
-Ursprüngliche Nachricht- Von: AndrewJames [mailto:andrewhu...@gmail.com] Gesendet: Freitag, 4. September 2009 13:35 An: Skoric, Majk; p...@computer.org; mysql@lists.mysql.com Betreff: Re: AW: Re: a better way, code technique? hahah thank-you, love the responses here. you guys

Re: Table Structure and Better way to query data

2003-03-04 Thread nocturno
Hello, I`m doing a database in MySQL to catalog cds, and i`m not sure if my table structure is the best way to do it: Artist Table Artist_Id int unsigned not null auto_increment primary key Name char(120) // Artist or Band Name Country char(30) // Artist Or Band Country Members char(255) //

Re: is there a better way to store comments in mysql table?

2003-02-27 Thread Paul DuBois
At 20:43 -0600 2/26/03, Paul DuBois wrote: At 21:32 -0500 2/26/03, Jianping Zhu wrote: I have a guest book which have three fields. user name email comments I want to mysql to store the information, but commnet maybe very long, is there a better way to handle it instead of set a varchar(2000

is there a better way to store comments in mysql table?

2003-02-26 Thread Jianping Zhu
I have a guest book which have three fields. user name email comments I want to mysql to store the information, but commnet maybe very long, is there a better way to handle it instead of set a varchar(2000) or more for a field comment in the table? Thanks

Re: is there a better way to store comments in mysql table?

2003-02-26 Thread Paul DuBois
At 21:32 -0500 2/26/03, Jianping Zhu wrote: I have a guest book which have three fields. user name email comments I want to mysql to store the information, but commnet maybe very long, is there a better way to handle it instead of set a varchar(2000) or more for a field comment in the table

Re: is there a better way to store comments in mysql table?

2003-02-26 Thread Jianping Zhu
maybe very long, is there a better way to handle it instead of set a varchar(2000) or more for a field comment in the table? VARCHAR has a maximum length of 2000. In MySQL 4.1, it will be converted automatically to TEXT. But you can use TEXT in any version of MySQL. Is that suitable for what

Re: is there a better way to store comments in mysql table?

2003-02-26 Thread Paul DuBois
, MEDIUMTEXT, and LONGTEXT. J.P. On Wed, 26 Feb 2003, Paul DuBois wrote: At 21:32 -0500 2/26/03, Jianping Zhu wrote: I have a guest book which have three fields. user name email comments I want to mysql to store the information, but commnet maybe very long, is there a better way to handle

Is there a better way?

2003-02-08 Thread James E Hicks III
Below is a little PHP code snippet which works great(returns results quickly) for single queries. However when I put this code into a loop incrementing the order_index and line, my application can take as long as 2 minutes to return results. Is there any other way to execute this series of queries