Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Sql Select statements

Options
  • 04-03-2005 2:07pm
    #1
    Closed Accounts Posts: 22


    hi, can someone help me, i have this 1 sql statement which i just cant figure out,,, my tables are customer table, order table, order details table, product table, payment table, employee table, supplier table,
    ive to
    create a query which takes todays date and adds the lead time for each product to it to determine the date when a supplier order will arrive. the result should display the product, the estimated delivery date and the current number of products in stock.


Comments

  • Registered Users Posts: 2,497 ✭✭✭optiplexgx270


    look at DATAADD()

    and what is the "lead time" is it an int in number of days?

    cos somethin like this will do it




    SELECT DATEADD(d, , GETDATE())

    select DATEADD(d, leadtime, GETDATE()) from producttable

    this adds "leadtime" which is an int days to the current date.


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    We'll need more details on the tables first like what fields each table contains
    i.e.

    Customer
    CustomerID - Int
    CustomerName - varchar(50)
    CustomerAddress - varchar(100)
    etc

    Then we'd have a much better chance of helping you. Plus if you map the tables out as above you'll be able to have a stab at the SQL query yourself and post that too (people are much more responsive if you post some code not matter how bad you think it is).
    <additional>
    I'd hazard a guess and say you'll only need the product, order and orderdetails tables.


Advertisement