sql select语句,指导正确的select语句

时间:2014-03-19 08:53:50

标签: mysql sql

我应该编写一个SQL查询,该查询将选择当前已检出并过期的所有图书,这些图书的库系统的值大于$ 10.00。我应该返回借款人的姓名,地址,邮政编码和电话号码,负责交易的图书管理员的姓名和电话号码,书籍退回的日期,姓名,费用和ISBN号这本书。我的查询应该按照返回日期的降序对列表进行排序。

这就是我写的

Select a.returndate as booklended ,a.isbn_number as booklended, b. as borrower,          
                    b.address as borrower, b.postalcode as borrower, b. phonenumber as 
                    borrower, c.name as     librarian, c.phonenumber as librarian
                from booklended.a, librarian.c, borrower.b
   where a. librarian id= c.librarianid
       and a.librarycard = b.librarycard
         and returndate < curdate()
         and cost  > 10.00
                order by a. returndate desc;

但是我收到了这个错误         5:无效的模式名称:声明中的BOOKLENDED [选择a.returndate作为booklended,a.isbn_number作为booklended,b。作为借款人,b。作为借款人,b.postalcode作为借款人,b。作为借款人的phonenumber,作为图书管理员的c.name,作为图书管理员的c.phonenumber

来自booklended.a]

请问我可以如何纠正这个问题。谢谢

2 个答案:

答案 0 :(得分:0)

尝试此查询

Select a.returndate as booklended ,a.isbn_number as isbnNumber, b.[YOUR COLUMNNAME FROM BORROWER TABLE] as borrower,        b.address as borrower, b.postalcode as borrower, b. phonenumber as borrower, c.name as     librarian, c.phonenumber as librarian

  from booklended as a, librarian as c, borrower as b
   where a.librarian id= c.librarianid
       and a.librarycard = b.librarycard
         and returndate < curdate()
         and cost  > 10.00
                order by a. returndate desc;

答案 1 :(得分:0)

试试这个:

Select a.returndate as booklended ,a.isbn_number as booklended,     
b.address as borrower, b.postalcode as borrower, b.phonenumber as 
borrower, c.name as librarian, c.phonenumber as librarian
from booklended a, librarian c, borrower b
where a. librarian id= c.librarianid
and a.librarycard = b.librarycard
and returndate < curdate()
and cost  > 10.00
order by a.returndate desc;