Jump to content

help with a difficult query


Recommended Posts

Hi, I have a query that gets these fields:

client

service group

service

clien1

TV

Basic TV

clien1

INTERNET

Hifh speed 1

 

I want to add to those fields another one that lists the number of services the number of services in each service group that the user still subscribe too.

I have a query that returns the number of services each subscriber has for each service category

 

Client

service group

number of services

Client1

Internet

1

Client2

TV

2

Client2

Cellphone

1

 

That last query returns millions of rows as my company has million of users and each user can have services in several service groups (internet, TV, Cellphone etc)

 

I am looking for a way to have the first query completed with information from the second query but only for the client in the result of the first query. I dont want it running the second query for every row of the first because then it would run a query that could return 4M lines presumably tens of thousands of times. Essentially what i want is a way to say: Hey i got this information from query one can you get me that more information from query two but only for this client, and rinse and repeat for each line of the first query.

 

Can anyone provide some helper as to how to do this? I'm a bit stuck .

 

Also I can't do that with several steps as I am working in a business intelligence tool that can only take query so a procedural approach wont work.

Thanks kindly,

JR

Link to comment
https://forums.phpfreaks.com/topic/230173-help-with-a-difficult-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.