Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Sql Select statements

  • 04-03-2005 02: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, Registered Users 2 Posts: 2,587 ✭✭✭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, Registered Users 2 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