Link to home
Start Free TrialLog in
Avatar of upobDaPlaya
upobDaPlaya

asked on

Why do I see a SELECt within a Inner Join clauses

I was reviewing someone's SQL code within MS Excel that really has me puzzled.  

It shows:
INNER JOIN(SELECT CUSTOMER.AC,",CUSTOMER.[OrderDate]
FROM CUSTOMER
WHERE[Status]='Current' AS CLIENT
ON....

Can someone help me with whats going on relative to these lines ?  Why is SELCT not its own line ?
Avatar of dbaSQL
dbaSQL
Flag of United States of America image

Looks to me like you're just missing the top part of the query.  See this example, with a top query INNER JOINed to a subquery.


SELECT p.Name, s.OrderQty
FROM Production.Product p INNER JOIN (      SELECT ProductID, OrderQty
                                                                       FROM Sales.SalesOrderDetail) s
                                                                        ON p.ProductID = s.ProductID
Avatar of upobDaPlaya
upobDaPlaya

ASKER

Got it..In your example is Production the name of the database and product the name of the table
ASKER CERTIFIED SOLUTION
Avatar of dbaSQL
dbaSQL
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Awesome..thanks for the reference also relative to the Objects !
My pleasure.