Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Over the past year I have found your site to be EXCELLENT. Never have I been able to find so many answers to such vast problems and it is an excellent service..."

Geography

Where in the world do Tek-Tips members come from?
beeboroach (TechnicalUser)
7 May 12 20:11
I need to use a subquery to create a list that shows the description and price for all products that were ever ordered. It should not show products that were never ordered.

This is what my relationships look like: http://s15.postimage.org/lfxn95hvt/test.png

Here's what I started with:
SELECT PRODUCT.Product_Description, PRODUCT.Standard_Price
FROM PRODUCT;

How do I make a subquery to exclude those that don't have an order id or..?
beeboroach (TechnicalUser)
7 May 12 20:27
NVM, I think I got it...

SELECT PRODUCT.Product_Description, PRODUCT.Standard_Price
FROM PRODUCT INNER JOIN Order_line ON PRODUCT.Product_ID = Order_line.Product_ID
WHERE PRODUCT.Product_ID IN
(
SELECT Order_line.Product_ID
FROM Order_line
Where Order_line.Product_ID=PRODUCT.Product_ID
)

Needed to refresh on a lot of subquery info.
PHV (MIS)
7 May 12 21:01
Why a subquery ?
SELECT DISTINCT PRODUCT.Product_Description, PRODUCT.Standard_Price
FROM PRODUCT INNER JOIN Order_line ON PRODUCT.Product_ID = Order_line.Product_ID

Hope This Helps, PH.
FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?

beeboroach (TechnicalUser)
7 May 12 21:02
Sorry if I didn't clarify, I was just trying to see how to use subqueries in that instant. I know how to use joins, thanks for your input though!

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close