3个表的URL方法? [英] URL Method for 3 tables?

查看:53
本文介绍了3个表的URL方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿所有人,


我一直在努力去理解上周检索信息的URL方法,但我被卡住了。我能够获得一个信息表,但现在我需要同时获得3个信息表,我遇到了麻烦。每个表都有一个与另一个表相同的数字,每个表都有一个保存数字的字段(但字段具有不同的名称)。例如,ticketMaster表包含字段pk_ticketID,其中包含数字1,serial包含字段pkb_fk_ticketNo,其中包含数字1,而parts包含字段fk_ticketNo,其中包含数字1.现在,我可以获取ticketMaster的正确表信息,但是序列部分我得到那些表中的所有记录,而不仅仅是所需的一条记录,在这种情况下是保存数字1的一条记录。


现在这就是我所拥有的

展开 | 选择 | Wrap | 行号

解决方案

您可以将所有三个组合成一个查询并执行连接操作。最好的方法取决于数据库和SQL使用的方言,但一个非常简单的方法是:

展开 | 选择 | 换行 | 行号


< blockquote>


您可以将所有三个组合成一个查询并执行连接操作。最好的方法取决于数据库和SQL使用的方言,但一个非常简单的方法是:

展开 | 选择 | 换行 | 行号


< blockquote>串口/部件和票证之间的关系是什么。它是多对一的,即一张票的许多连续剧和零件?


Hey Everyone,

i been working on trying to understand the URL method of retrieving information for the last week, but i am stuck. I been able to get one table of information, but now i need to get 3 tables of information at the same time an i am running into trouble. Each table has a number in common with the other, each has a field that holds the number (but fields have different name). For example ticketMaster table has the field pk_ticketID which holds the number 1, serial has the field pkb_fk_ticketNo which holds the number 1, and parts has the field fk_ticketNo which holds the number 1. Right now i can get the correct table information for ticketMaster but for the serial an parts i get all the records that are in those tables instead of just the one record needed, which in this case is the one record that holds the number 1.

Right now here is what i have


Expand|Select|Wrap|Line Numbers

解决方案

You could combine all three into one query and perform a join operation. The best way would depend on the database and the dialect of SQL used, but a very simple way would be something like:

Expand|Select|Wrap|Line Numbers


You could combine all three into one query and perform a join operation. The best way would depend on the database and the dialect of SQL used, but a very simple way would be something like:

Expand|Select|Wrap|Line Numbers


What''s the relationship between serial/parts and ticket. Is it many-to-one, i.e. many serials and parts to one ticket?


这篇关于3个表的URL方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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