Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT with data in another table

Status
Not open for further replies.

Niavlys

IS-IT--Management
Jun 3, 2002
197
CA
Hi,
It seems simple but I can't figure out how to do this. I have 2 tables (Printers and Cartridges). Here is the basic structure:

Code:
Printers                   Cartridges

ID                         idCartridge
idBlack                    cartNumber
idCyan                     
idYellow
idMagenta
I want to select all printers from table Printers but instead of having the ids for the cartridges, I want to link the tables to have the cartNumber instead.
I hope someone understands my problem. It's hard to explain.

Thanks for your help.
 
No, ID is the primary key for Printers table.

idBlack = idCartridge
idCyan = idCartridge
idYellow = idCartdridge
idMagenta = idCartdridge

 
Try...

select P.id, c.cartNumber
from Printers p
join Cartridges C
on p.idBlack = c.idCartridge

Simi
 
If that doesn't do it, provide us sample data and what results you want to see.

-SQLBill

The following is part of my signature block and is only intended to be informational.
Posting advice: FAQ481-4875
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top