Solved

select where one attribute has another

Posted on 2007-12-06
4
206 Views
Last Modified: 2012-05-05
this is a weird one, maybe.  i'm in the process writing the procedure below 3 different ways

1., give me the stats on each endpoint, all clients
2., give me the stats on each client, all endpoints
3., give me the stats on each endpoint/client pair  (this is the one posted below)

select b.EndPoint,b.Client,min(a.latency) AS MIN, max(a.latency) AS MAX, AVG(a.latency) AS AVG, stdev(a.latency) AS StDEV
FROM tableA a inner join tableBp b WITH (NOLOCK)
ON a.orderno = b.orderno
GROUP BY endpoint,client

unfortunately, in some cases, there are orderno's without endpoint and/or clients.  what is the most appropriate way to restrict my dataset to only those orderno's with an endpoint AND client ?
0
Comment
Question by:dbaSQL
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 25

Accepted Solution

by:
imitchie earned 350 total points
ID: 20422196
>>what is the most appropriate way to restrict my dataset to only those orderno's with an endpoint AND client ?

select b.EndPoint,b.Client,min(a.latency) AS MIN, max(a.latency) AS MAX, AVG(a.latency) AS AVG, stdev(a.latency) AS StDEV
FROM tableA a inner join tableBp b WITH (NOLOCK)
ON a.orderno = b.orderno
WHERE b.Client is not null and b.EndPoint is not null
GROUP BY endpoint,client
0
 
LVL 17

Author Comment

by:dbaSQL
ID: 20422215
oh gosh.  unreal why i did not think of that.... jeeze
thank you ,imitchie
0
 
LVL 25

Expert Comment

by:imitchie
ID: 20422216
1., give me the stats on each endpoint, all clients

select
  b.EndPoint, min(a.latency) AS MIN, max(a.latency) AS MAX,
  AVG(a.latency) AS AVG, stdev(a.latency) AS StDEV
FROM tableA a
inner join tableBp b WITH (NOLOCK) ON a.orderno = b.orderno
WHERE b.Client is not null and b.EndPoint is not null  -- restricted
GROUP BY b.endpoint

2., give me the stats on each client, all endpoints

select
  b.Client, min(a.latency) AS MIN, max(a.latency) AS MAX,
  AVG(a.latency) AS AVG, stdev(a.latency) AS StDEV
FROM tableA a
inner join tableBp b WITH (NOLOCK) ON a.orderno = b.orderno
WHERE b.Client is not null and b.EndPoint is not null    -- restricted
GROUP BY b.Client

3., give me the stats on each endpoint/client pair  (this is the one posted below)
-- posted above
0
 
LVL 17

Author Comment

by:dbaSQL
ID: 20422221
surely i was overthinking that one.... missing the total obvious
ugh

again, though, thank you very much
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question