如何查询从两个表中选择的数据 [英] how to query for data selecting from two tables

查看:66
本文介绍了如何查询从两个表中选择的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个表
1. tblVehicle,其中Vehid为主键,Custid为外键,Vehentrytime为列表
2. tblCusotmer,其中"Custid"作为主键,"Vehtype"作为表列

我想从tblCustomer中选择其输入时间与tblVehicle中的查询选择的车辆类型

从两个表中选择此类数据的查询是什么
回复代码
关于bishnu

i have two tables
1. tblVehicle with Vehid as primary key,Custid as foreign key and Vehentrytime as a table of column
2. tblCusotmer with Custid as primary key and Vehtype as table column

i want to select those vehicle types from tblCustomer whose entry time is as selected by the query from tblVehicle

what would be the query for selecting such datas from two tables
reply with the codes
with regards bishnu

推荐答案

尝试一下

try this

Select TC.Vehtype from tblCusotmer TC inner join tblVehicle TV
on TC.Custid =TV.Custid  
where  TV.Vehentrytime='your datetime parameter'    


尝试一下:
Try this:
SELECT C.vehicletype FROM tblCusotmer  C INNER JOIN tblVehicle V ON C.Custid =V.Custid WHERE  V.Vehentrytim='Your Selected datetime';


这篇关于如何查询从两个表中选择的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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