Advertisement

06.11.2008 at 06:31AM PDT, ID: 23475652
[x]
Attachment Details

How do I joint 2 simple SQL statements?

Asked by deakie in SQL Query Syntax

Tags: SQL

I have two simple sql statements that I need to join...how would I do that?
P.SEQUENCE is the same as D.SEQUENCE
AND P.BILL is the same as M.IDENT

Here are the statements:
SELECT P.BILL, P.SEQUENCE, P.LOCATION, P.TYPE
      FROM dbo.POLICY P
      WHERE P.BILL = '24680'

SELECT M.IDENT, D.SEQUENCE, I.IDENT, S.IDENT, D.*
      FROM BILL M (NOLOCK),
            INVOICE I ,
            STATUS S ,
            STATUSDETAIL D
      WHERE M.IDENT = '24680'
            AND I.IDENT = '13579'
            AND I.BILL = M.IDENT
            AND S.INVOICE = I.IDENT
            AND D.STATUS = S.IDENTStart Free Trial
[+][-]06.11.2008 at 06:45AM PDT, ID: 21759964

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.11.2008 at 06:46AM PDT, ID: 21759969

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: SQL Query Syntax
Tags: SQL
Sign Up Now!
Solution Provided By: dragos_craciun
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628