Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Microsoft SQL Server > Re: Use of havi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 5 Topic 10994 of 11517
Post > Topic >>

Re: Use of having with additional select

by "Plamen Ratchev" <Plamen@[EMAIL PROTECTED] > Apr 23, 2008 at 10:14 PM

I agree with Hugo that the information you provided is not sufficient to 
give you a good answer. Here is just a guess based on your explanation and

expected results:

SELECT C.cerveh, C.monto1, A.prima
FROM Arysauto AS A
JOIN (SELECT ramo, cerveh, poliza, stcdcb,
                   SUM(monto1) AS monto1
        FROM Clpf08
        GROUP BY ramo, cerveh, poliza, stcdcb) AS C
  ON A.cerveh = C.cerveh
WHERE C.ramo = 31
   AND C.poliza = 6100265
   AND C.stcdcb = ' '
   AND EXISTS (SELECT *
                    FROM Clpf07 AS B
                    WHERE B.ramo = C.ramo
                       AND B.poliza = C.poliza
                       AND B.cerveh = C.cerveh
                       AND B.actret <> 'R')
   AND C.monto1 - A.prima > 0;

HTH,

Plamen Ratchev
http://www.SQLStudio.com
 




 5 Posts in Topic:
Use of having with additional select
Seguros Catatumbo <seg  2008-04-23 12:10:34 
Re: Use of having with additional select
Hugo Kornelis <hugo@[E  2008-04-23 21:52:54 
Re: Use of having with additional select
Seguros Catatumbo <seg  2008-04-23 13:49:49 
Re: Use of having with additional select
Hugo Kornelis <hugo@[E  2008-04-24 00:13:58 
Re: Use of having with additional select
"Plamen Ratchev"  2008-04-23 22:14:22 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Dec 3 1:02:06 CST 2008.