Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2004
    Posts
    1

    Question Unanswered: Problem with queries

    Hello everybody,I am a newbie here.I have a problem with 2 queries in a database I have set up.The database is about a library and it has 4 tables (loan,member,personnel and book).

    1)In the loan table there is a field called loan_start_date.According the case of the problem I want to make a query to calculate the return date which must be 3 weeks after the loan_start_date.

    2)The second query needs to work out the fines for the overdue books.The fine is 25p per day over the allowed loan time.

    I will appreciate your help because I made a lot of queries with the builder but there were all wrong.Thank you very much.

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Make an UPDATE Query, it should like something that:

    UPDATE loan SET loan.loan_end_date = [loan_Start_date ]+21;

  3. #3
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    it is almost always not a good idea to store data that can be calculated in a query

    e.g. there's no need to have an end date in the table

    select dateadd("d",21,loan_start_date) as loan_end_date ...
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •