Re: SELECT missing records

2007-07-12 Thread Perrin Harkins
On 7/12/07, mos <[EMAIL PROTECTED]> wrote: BTW, joins will work faster if you load one or more tables in a Memory table before you do the join. Well, if your tables are so small that you can load them entirely into memory, it probably doesn't matter how you code the query. - Perrin -- MySQL G

Re: SELECT missing records

2007-07-12 Thread mos
At 07:26 PM 7/12/2007, Perrin Harkins wrote: On 7/12/07, Jerry Schwartz <[EMAIL PROTECTED]> wrote: Since the "rows" is identical except for the last bit, where mine is 4 and yours is 2, does that mean yours is roughly more efficient by a 2:1 ratio? For the most part, MySQL will do better with

Re: SELECT missing records

2007-07-12 Thread Perrin Harkins
On 7/12/07, Jerry Schwartz <[EMAIL PROTECTED]> wrote: Since the "rows" is identical except for the last bit, where mine is 4 and yours is 2, does that mean yours is roughly more efficient by a 2:1 ratio? For the most part, MySQL will do better with LEFT JOIN than an IN subquery. You can read a

Re: SELECT missing records

2007-07-12 Thread Perrin Harkins
On 7/12/07, Jerry Schwartz <[EMAIL PROTECTED]> wrote: I think that will give me one record for every price that is not Yen, so if a product has a price in USD and a price in GBP it will show up twice. That would happen if you removed the 'USD' condition from the first JOIN. Like I said, I'm no

RE: SELECT missing records

2007-07-12 Thread Jerry Schwartz
My apologies, you were correct: I left out a line from my query, so it would have given bogus results except for the fortunate fact that every product having at least one price has a USD price. The EXPLAIN output didn't change. Regards, Jerry Schwartz The Infoshop by Global Information Incorpora

RE: SELECT missing records

2007-07-12 Thread Jerry Schwartz
I never thought of putting an additional condition on the LEFT JOIN. That seems to do the trick. My original query, with the sub-SELECT, does work. Both your technique and mine generate identical results. I did an EXPLAIN on each technique, but I don't know enough to interpret it. Since the "row

RE: SELECT missing records

2007-07-12 Thread Jerry Schwartz
2007 12:05 PM To: Jerry Schwartz Cc: mysql@lists.mysql.com Subject: Re: SELECT missing records Try this SELECT prod.prod_num, price.prod_price FROM prod JOIN price WHERE prod.prod_id = price.prod_id AND price.prod_curr !='YEN'; On 7/12/07, Jerry Schwartz <[EMAIL PROTECTED]&

Re: SELECT missing records

2007-07-12 Thread Perrin Harkins
On 7/12/07, Jerry Schwartz <[EMAIL PROTECTED]> wrote: I believe this query will do it, but can it be redone without the sub-query by using JOINs? Yes, use a LEFT JOIN. Would that be more efficient? Yes. SELECT prod.prod_num, price.prod_price FROM prod JOIN price WHERE prod.prod_id = price

Re: SELECT missing records

2007-07-12 Thread Ananda Kumar
Try this SELECT prod.prod_num, price.prod_price FROM prod JOIN price WHERE prod.prod_id = price.prod_id AND price.prod_curr !='YEN'; On 7/12/07, Jerry Schwartz <[EMAIL PROTECTED]> wrote: I've been banging my head against the walls for hours, so I hope somebody can help. I know similar questi

SELECT missing records

2007-07-12 Thread Jerry Schwartz
I've been banging my head against the walls for hours, so I hope somebody can help. I know similar questions have been answered in the past. I have two tables, prod and price. Stripping out the non-essential fields, they are pretty simple: prod --- prod_num (int) prod_id (char 15) price

Re: missing records

2002-08-26 Thread Egor Egorov
Dave, Saturday, August 24, 2002, 2:53:59 AM, you wrote: DR> I upgraded my server and seem to have lost some MySql records. Is there a way to recover lost records? DR> Or could it be a index problem? If you check tables with CHECK TABLE clause, do you get any error or warning? If so, repair tabl

Re: missing records

2002-08-25 Thread Dicky Wahyu Purnomo
Pada Fri, 23 Aug 2002 16:53:59 -0700 Dave Reinhardt <[EMAIL PROTECTED]> menulis : > I upgraded my server and seem to have lost some MySql records. Is there a way to >recover lost records? > Or could it be a index problem? how did you upgrade it ? and from what information you notice that you've