从不同的表获取数据 [英] Getting Datas from Different Table

查看:43
本文介绍了从不同的表获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我创建了3个表,即a,b,c.在ci中创建了datagrid视图,我需要从a和B表中检索数据,即从``a''表中的第一列,从``b''中的第三列' 桌子.如何找回它.

问候
Balamurugan

Hi,
I have created 3 tables namely a,b,c.In c i have created the datagrid view and i need to retrive the datas from a and B table i.e First column from ''a'' table second and third column from ''b'' table. How to retrieve it.

Regards
Balamurugan

推荐答案

考虑到问题的非常抽象的性质,我唯一能想到的答案就是下面的归类查询
考虑到表A,B和C具有外键关系,可以编写查询

considering very abstract nature of the question, the only answer I could think of is as a genralized query as below
Consider Table A, B and C are having foreign key relationship, you can write a query

select a.firstcolumn,b.secondcolumn,b.thirdcolumn
from tableA, tableB, tableC
where
tableA.primaryKeyColumn = tableB.ForeignKeyColumn
and 
tableB.PrimaryKeyColumn = tableC.ForeignKeyColumn



在查询中替换适当的列和表名称,

希望能有所帮助.
-Milind



Replace appropriate column and table name in the query,

Hope that helps.
-Milind


这篇关于从不同的表获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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