Jump to content

fastsol

Moderators
  • Content Count

    817
  • Joined

  • Last visited

  • Days Won

    9

fastsol last won the day on July 26 2015

fastsol had the most liked content!

Community Reputation

39 Good

About fastsol

  • Rank
    Prolific Member
  • Birthday 10/17/1978

Contact Methods

  • Website URL
    http://amecms.com

Profile Information

  • Gender
    Male
  • Location
    Minnesota

Recent Profile Visitors

204,675 profile views
  1. Wow you are amazing with mysql! That query seems to work just great. Almost seems to work a little faster too, just a smidge. Thank you so much!
  2. @Barand Thank you so much for the help. I've decided to use this version of your query with slight modifications that haven't impacted the performance from what I have tested. SELECT `a1`.`id` AS `id` FROM ( ( `customers` `a1` JOIN `customers` `b1` ON ( ( (`a1`.`email` = `b1`.`email`) AND(`a1`.`id` <> `b1`.`id`) AND( `a1`.`email` <> 'blah@example.com' ) AND( `b1`.`email` <> 'blah@example.com'
  3. I tried your new query and yes it is much faster than mine when gathering a large number of records at a time, even when paging through the results it really shines. BUT it's still much slower than mine when grabbing a single record. Mine is still .0015 ish and your new one is .15 ish. Since I'll be doing both single and multi record queries this new query might be the way to go. With multi record pulls mine goes up in time exponentially where yours stays consistent at that .12-.15. I'd still like to get the single record pull down in time but it's liveable. I did email you my s
  4. Clearly we have something different between our table setups for this. I'll try to get you a version of my tables where the personal data is altered for privacy. Then hopefully you can find the cause behind the lag on my end.
  5. Nice example! Seems accurate enough in table layout to determine what I need figured out. The results you list for my query are the correct ones based on your table data. Customers 12 and 15 should be listed because the email or phone for those customers is the same as another customer that has a purchased of 1. Basically what I'm doing here is as new customers get added, it needs to check for previous customers and see if the email or phone is the same AND if any of the previous customers matching have also purchased. If that condition is true, then it returns the new customers
  6. So here is the query that I finally got to work in a way that I can handle. The only thing I see as a potential problem is that the query is extremely slow, at least for the initial saving of the view. It seems to perform well enough when querying for a single record from the view. SELECT `a`.`id` AS `customer_id` FROM `customers` `a` WHERE ( SELECT `b`.`id` FROM ( `customers` `b` JOIN `quotes` ON ( ( `b`.`id` = `quotes`.`customer_id` ) ) ) WHERE
  7. @BarandThe problem with your recent query seems to be stemming from the fact that early records don't always have a phone number.
  8. If that's supposed to be the entire query for the view, then it doesn't work. It gives me a ton of results that are all identical with the same id and email and no phone number.
  9. I'm getting much much closer. I ended up using a View table to build the query and then a hasOne eloquent relationship which is working as expected at the moment. @Barand I used your query above in the view with some additions. The only thing that isn't working with the query is lets say a customer is listed more than once in the db with the same email, then they are listed in your query results BUT if a customer is listed more than once with different emails but same phone numbers then they are not listed in your query results. I need the customer to be listed in either of thos
  10. Because on several pages if I don't do it with eager loading it will cause an N+1 query problem. Plus I don't need or want to load this info on every page as there will also be many times I don't need the extra info. Maybe I'm splitting hairs on not needing all the info all the time. I'll consider it if there is no other way to do it.
  11. Or could this maybe be done with a pivot table or a view table and then ran through a eloquent relationship?
  12. This relationship query gets me the correct results but it doesn't when using with() or load() on the model for eager loading. return $this->hasMany($this, 'id')->where('customers.id', '<>', $this->id) ->orWhere(function($query){ $query->where('customers.id', '<>', $this->id) ->where(function($query){ $query->where('email', $this->email) ->orWhere('phone', $this->phone); }); }); So
  13. Duplicate customers. The same person may have made multiple purchases under the same email or phone number in the Customers table. I need to do this with an Eloquent relationship though.
  14. So I have a Customers table with normal fields and a standard ID primary key field. I am trying to find a way through a relationship method to get a collection of repeat customers. Sounds simple and can easily be done with query like so public function repeatCustomer() { return $this->where('id', '<>', $this->id) ->where(function($query){ $query->where('emai', $this->email) ->orWhere('phone', $this->phone); })->get(); } But that can't be loaded or eager loaded as a relationship. I don't have nor do I really want to have a parent_id typ
  15. Found it, on the hosting server the Master is listed as 500M but the Local version says 32M. Thank you, I will track down where that is being set.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.