I have two tables as below

table 1
ProductID---Int
Descritption---Text

table 2
Id
FK_ProductID--Int
Category

but on the FK_ProductID I dont want my table not to display a number but the description from TBLA.

Recommended Answers

All 7 Replies

SELECT t1.Description, t2.Category
FROM table2 t2
inner join table1 t1
on t1.ProductId = t2.ProductId
SELECT t1.Description, t2.Category
FROM table2 t2
inner join table1 t1
on t1.ProductId = t2.ProductId

thanks for your respond

I am not trying to retrieve data from the table.but want this to show in my real table, Is it possible?

Regards
Sally.

i don't get what you are meaning, you just said you wanted to select from the table without displaying the id

what is a real table?

i don't get what you are meaning, you just said you wanted to select from the table without displaying the id

what is a real table?

sorry about misunderstanding

I have two tables:
TblA
ProductID
Description

TblB
ID
Fk_ProductID
Order

for the data in real tables , I want to know if is it possible for the field Fk_ProductID to show description not the productID.

as in you want the fk to be linked to the description?
the query i gave you return the description and category
i'm still not sure what you are needing

hi

when opening tblB , the field FK_ProductID should be filled in with the description not the ID from tblA.

I dont want to see the ID but the description corresponding to that ID on the FK field

is it possible?

that is the point of a relational database, to have entities (such as products) grouped with themselves, and their id field be used when they are referenced, that is why you have to build the query to "pull" the description from the id like i gave you

SELECT t1.Description, t2.Category
FROM table2 t2
inner join table1 t1
on t1.ProductId = t2.ProductId
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.