1

select check_num,concat(Pat_FName,' ',Pat_LName),Book_Title,
concat(Au_FName,' ',Au_LName),check_out_date,Check_Due_Date
from checkout,Patron,Author,Book,Writes
where
Author.Au_ID=writes.Au_ID and
Writes.Book_Num=Book.Book_Num and
Book.Book_Num=checkout.book_num and
checkout.pat_ID=Patron.Pat_ID
and Pat_Type like 'Faculty'
order by check_out_date desc;

How can I resolve this? I do not know how to solve it since it just keeps showing that.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Eli Mapue
  • 17
  • 3
  • 1
    How do you run this query? Why are you not using JOINs? – Chetan Apr 30 '22 at 15:52
  • I'm trying to write a query to display the checkout number, patron’s name (collated), book title, author’s name (collated), checkout date, and due date for every checkout that has ever occurred in the system by a faculty patron. Sort the results by checkout date in descending order and that is what I came up with. I could use a little bit of help since I am still not that proficient in SQL. – Eli Mapue Apr 30 '22 at 15:56

1 Answers1

1

The problem is that you try to use concat for 3 strings, this is not possible in this way since concat expects 2 strings. You can use || instead...

Pat_FName || ' ' || Pat_LName

...or you can "concat" your concats ;)

CONCAT(CONCAT(Pat_FName,' '), Pat_LName)

Besides this issue, you should avoid joining tables in this way and prefer the usage of JOIN. And a last hint: You should avoid using "like" (in your last line before the order by) when only comparing to an exact string because like is slow. In this case, you should use = instead. Generally, having a look to SQL tutorials might help a lot.

Jonas Metzler
  • 4,517
  • 1
  • 5
  • 17