使用连接创建表 [英] Create table using joins

查看:59
本文介绍了使用连接创建表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮帮我。我非常紧急。


我有三张桌子

1学生_大师:

stu_id(pk),姓名,phoneno,父亲姓名,地址,大学名称,班级,照片;


2 Student_detail

slno(pk),stu_id(fk),subject,teachername,stu_name,batchday,batchtime


3 fee_detail

stu_id(fk),总金额,支付金额;


我的问题是我必须检索以下字段,其中给出了Teachername。


stu_id,stu_name,classname,subject,paidMoney where teachername = somevalue


i试图写下查询,但我失败了。

PLZ任何人都可以帮助我。

i预感谢。

解决方案

试试这个:


[PHP]

选择sd.stu_id,sm.name为stu_name,sm.class为classname,sd.subject,[付费金额]为paidMoney

来自Student_detail sd

加入Student_master sm on sd.stu_id = sm.stu_id

加入fee_detail fd on sd.stu_id = fd.stu_id

其中,teachername = somevalue [/ PHP]


好​​运


嗨感谢您的帮助

i trid此查询。但它给出了错误


语法附近的语法错误


我给出了我写的查询:

选择sd.stu_id,sm.Stu_name为studentName,sm.className为cname,sd.subject为ssubject,fd.Paid_Money为paidmoney from xiStu_detail sd join xiStudent_master sm on sd.stu_id = sm.stu_id join fee_Detail fd在sd.stu_id = fd.stu_id,其中Teachername =''KKK''


哪里是我找不到的错误。

如果你给我解决方案我很感激你。


一切都很好。


试试这个:


[PHP]

从xiStu_detail sd选择*



在sd.stu_id = sm.stu_id加入xiStudent_master sm

加入费用_Detail fd on sd.stu_id = fd.stu_id

其中,Teachername ='''KKK''[/ PHP]


如果您有错误请告诉我方式。

Please help me. iTs very urgent.

I have three Tables
1 Student_master:
stu_id(pk),name,phoneno,fathername,address,college name,class,photo;

2 Student_detail
slno(pk),stu_id(fk), subject,teachername,stu_name,batchday,batchtime

3 fee_detail
stu_id(fk),Total amount, Paid amount;

my problem is that i have to retrieve the following fields where teachername is given.

stu_id,stu_name,classname,subject,paidMoney where teachername=somevalue

i tried to write the query but i failed.
plz anyone can help me .
i advancely thanks .

解决方案

Try this:

[PHP]
Select sd.stu_id, sm.name as stu_name, sm.class as classname, sd.subject, [Paid amount] as paidMoney
From Student_detail sd
Join Student_master sm on sd.stu_id = sm.stu_id
Join fee_detail fd on sd.stu_id = fd.stu_id
Where teachername = somevalue[/PHP]

Good Luck


hi thanks for help
i trid this query. but it gives the error as

Syntax error near from Clause

I give the query which i write:

select sd.stu_id,sm.Stu_name as studentName,sm.className as cname,sd.subject as ssubject,fd.Paid_Money as paidmoney from xiStu_detail sd join xiStudent_master sm on sd.stu_id=sm.stu_id join fee_Detail fd on sd.stu_id=fd.stu_id where Teachername=''KKK''

where is the error i could not find.
if u give me solution i grateful to u.


Everything looks good.

Try this:

[PHP]
Select *
from xiStu_detail sd
join xiStudent_master sm on sd.stu_id = sm.stu_id
join fee_Detail fd on sd.stu_id = fd.stu_id
where Teachername = ''KKK''[/PHP]

Let me know if you have an error this way.


这篇关于使用连接创建表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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