Click here to Skip to main content
15,895,656 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I m making a web based Library automation system,I want a code for checking the availabaility of books , each book has its own id. when some books are issued and some are remaining then the code shows the availability of books.
i made separate tables for issue_return and book, so please guide me in this regard
Posted
Updated 3-Mar-11 0:12am
v2
Comments
R. Giskard Reventlov 3-Mar-11 6:18am    
What have you already tried?
OriginalGriff 3-Mar-11 7:05am    
To be of any real help, we would need to know more info: specifically about your database tables. Since we don't know how you store books, what you do with your issue_return table, and so on, we can't really give you concrete advice.

What's in your tables? How do the tables relate? Can the layout be changed?
Edit your question, and try to provide info, or we can't help you with your homework.
Sandeep Mewara 3-Mar-11 9:53am    
What are you asking here for? Code or some guidance?
muntahach 3-Mar-11 12:20pm    
In book table i store 25 attributes including Book ISBN,Book ID, Title...Subject,In Issue return Table, I store book Id,ISBN and some other attributes, i want that when some user check the availability of books (when he enter book title and search book)then the Same title Book's ISBN are counted and from it the number of book that are issued and whose status is issued are subtracted
and the availibity of book is shown to the user,whether it is available or not,How the query is formed for this?
muntahach 3-Mar-11 12:22pm    
If code is given, well in good, if not then some guidance

1 solution

As I see it:

tbl_book
--------------
ID (int)
BookISBN (varchar)
BookTitle(varchar)
etc....

- responsible for storing information about books

tbl_issue_return
---------------------
ID (int)
BookID (int)(FK)
IssueDate (datetime)
ReturnDate (datetime)
etc....

- responsible for storing issued book entries, as well as wether or not the book has been returned.


SQL to get all available books:
---------------------------------
SELECT * FROM tbl_book b
WHERE
b.ID NOT IN (SELECT i.ID from tbl_issue_return i where i.ReturnDate IS NULL);


SQL to get all issues books (books that are unavailable)
----------------------------------------------------------
SELECT i.ID from tbl_issue_return i where i.ReturnDate IS NULL;

As the responses to your original question stated, without more information, my ideas could be way off base. From the information presented, this is as good of a reply as I can make. Also, I'm not claiming that this would be the most efficient means of doing this.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900