查询从两个表中获取数据 [英] query for getting data from two tables

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

问题描述

我有三张桌子

1.sudent with sid,seatno,vehicleno

2.emp with eid,seatno,vehicleno

3 .vehicle with vehicleno,总座位

i希望从两个学生amd emp表中得到计数(seatno)以获得由

学生和emp为基础的席位数on vehicleno

i have three tables
1.student with sid,seatno,vehicleno
2.emp with eid,seatno,vehicleno
3.vehicle with vehicleno,total seats
i want to get the count(seatno) from both student amd emp table to get the no of seats filled by
both student and emp based on vehicleno

推荐答案

select  (select count(seatno) from  student ) + (select count(seatno) from emp )


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

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