Jump to content

Recommended Posts

Posted
9 hours ago, activa said:

What is the best and correct query to get all services that use the package X . Basing in the package_group_id return incorrect data for some packages .

take this, i use it and i can get the total services using the package X with option to filter per service status

    public function getUsedServices($package_id, $service_status = null)
    {
        $this->Record->select('services.id')->from('package_pricing')->
            innerJoin('services', 'services.pricing_id', '=', 'package_pricing.id', false)->
            where('package_pricing.package_id', '=', $package_id);

		if ($service_status) {
			$this->Record->where('services.status', '=', $service_status);
		}

		return $this->Record->numResults();	
    }

 

you can use it as getUsedServices($package_id, 'active')  to get total active services using the package X

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...