本文介绍了我需要你的帮助来解决这些家伙。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我有两张桌子.. 1- student_details sid sname sphonenum 1 x 123 2 y 245 3 z 985 2-book_details bid bname bauthor 12 DAA XYZ 23 FLAT BHG 现在我创建了一个借出表来存储lendign详细信息,其中sid和bid是外键 3- lend_details lid sid bid lend_time 214 1 23 xx:xx:xx 我的问题是如何检索以下详细信息 lid sid sname bid bname bauthor lend_time 214 1 x 23 FLAT BHG XX:XX:XX 希望我现在清楚..我新的sql并尝试创建库管理数据库.. 感谢advace 解决方案 尝试: SELECT s.Sid​​,s.StudentName,b.BID,b.BookName ,l.LendTime FROM LEND_DETAILS l JOIN STUDENT_DETAILS s ON l.SIS = s.SID JOIN BOOK_DETAILS b ON l.BID = b.BID 与所有表建立内部联接。 基于常见的SId字段。 Lend_Details表和Student_Details表将被加入。 基于常见的BID字段,Book_Details tble和Lend_Detail将被加入。 SELECT L.LId ,L.SId ,S.SName , L.BId ,B.BName ,L.Land_Time 来自Lend_Details L INNER JOIN Student_Details S ON S.SId = L.SId INNER JOIN Book_Details B ON B.BId = L.BId i have two tables..1- student_details sid sname sphonenum 1 x 123 2 y 245 3 z 9852-book_details bid bname bauthor 12 DAA XYZ 23 FLAT BHGnow i have created a lend table which stores lendign details where sid and bid are foreign key3- lend_details lid sid bid lend_time 214 1 23 xx:xx:xx my question is how can i retrieve the following details lid sid sname bid bname bauthor lend_time214 1 x 23 FLAT BHG XX:XX:XXhope im clear now..im new to sql and trying to create library management database ..thanks in advace 解决方案 Try:SELECT s.Sid, s.StudentName, b.BID, b.BookName, l.LendTime FROM LEND_DETAILS lJOIN STUDENT_DETAILS s ON l.SIS = s.SIDJOIN BOOK_DETAILS b ON l.BID=b.BIDEstablish inner join with all tables.Based on common SId field. Lend_Details Table and Student_Details table will be joined.Based on common BID Field, Book_Details tble and Lend_Detail will be joined. SELECT L.LId,L.SId,S.SName,L.BId,B.BName,L.Land_TimeFROM Lend_Details LINNER JOIN Student_Details S ON S.SId = L.SIdINNER JOIN Book_Details B ON B.BId = L.BId 这篇关于我需要你的帮助来解决这些家伙。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-22 11:59