如何使用相同的主键值以及如何在同一个外键表中调用两次? [英] How to use the same primary key value and how to call two time in same foreign key table?

查看:71
本文介绍了如何使用相同的主键值以及如何在同一个外键表中调用两次?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

< pre lang =text>我有两个表以及如何在c#
中创建关系1)TBL_PDT(产品),pdt_id(主键), pdt_name,pdt_description;
2)TBL_SIMILAR_PDT(类似产品),sid(TBL_PDT的外键),sim L_PDT),sim_pdt_id(TBL_PDT的外键),sim_pdt_desc;

1)如何从同一个外键表(TBL_SIMILAR_PDT)调用相同的产品ID?

2)如何输入值dropdownlist1(pdt_id)和dropdownlist2(pdt_id)?







请帮助我!!!

解决方案

使用类似于此的一些SQL来返回类似的item:



 选择 * 来自 tbl_similar_pdt 其中​​((sid = VALUE)(sim_pdt_id = VALUE)) 


<pre lang="text">I have two table and how to create the relationship in c# 
1)TBL_PDT(product),pdt_id (primary key),pdt_name,pdt_description;
2)TBL_SIMILAR_PDT(similar product),sid(foreign key of TBL_PDT),sim L_PDT),sim_pdt_id(foreign key of TBL_PDT),sim_pdt_desc;

1)how to call the same product id from same foreign key table (TBL_SIMILAR_PDT)?

2)how to values are dropdownlist1(pdt_id) and dropdownlist2(pdt_id)?




PLEASE HELP ME!!!

解决方案

Use a bit of SQL similar to this to return similar items:

select * from tbl_similar_pdt where ((sid = VALUE) or (sim_pdt_id = VALUE))


这篇关于如何使用相同的主键值以及如何在同一个外键表中调用两次?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆