The orders after 12 am to 7 am not show data problem

  • Hi guys

    I make sql query to select data every day by getdate function

    In sql server 2005 i write the following query

    ALTER proc [dbo].[JeddahSalesAll]

    as

    SELECT ROW_NUMBER() OVER (ORDER BY dbo.[Jeddah-Live$Sales Header].No_) AS [S.N], dbo.[Jeddah-Live$Sales Line].[Document No_] AS 'OrderNo',

    dbo.[Jeddah-Live$Sales Header].[Bill-to Name] AS 'CustomerNo', dbo.[Jeddah-Live$Sales Line].Area AS 'Shippment Type', dbo.[Jeddah-Live$Sales Line].Description AS 'Description',

    dbo.[Jeddah-Live$Sales Header].[Pump No_] AS 'PumpNo', CAST(ROUND(dbo.[Jeddah-Live$Sales Line].Quantity, 0, 1) AS int) AS 'Required Qunatity',

    CAST(ROUND(dbo.[Jeddah-Live$Sales Line].[Quantity Shipped], 0, 1) AS int) AS 'Shipped Quantity', CAST(ROUND(dbo.[Jeddah-Live$Sales Line].[Outstanding Quantity], 0,

    1) AS int) AS 'Outstanding Qunatity '

    FROM dbo.[Jeddah-Live$Sales Header] INNER JOIN

    dbo.[Jeddah-Live$Sales Line] ON dbo.[Jeddah-Live$Sales Header].No_ = dbo.[Jeddah-Live$Sales Line].[Document No_] AND

    dbo.[Jeddah-Live$Sales Header].[Sell-to Customer No_] = dbo.[Jeddah-Live$Sales Line].[Sell-to Customer No_]

    WHERE DATEDIFF(d,dbo.[Jeddah-Live$Sales Line].[Shipment Date],GETDATE()) = 0

    query above work success no any problem

    only problem the order start 8 pm in date(31/03/2015) and finish 7 am in date(01/04/2015)

    at next day

    what i do to show the orders done from 12 am to 7 am to show them

    meaning i need to show orders from 8 pm to 7 am

    the query get data until 12 clock and stop

    How to modify query to accept day tomorrow until 7 clock

    if you have solution or suggestion to solve problem help me if possible

    thanks

  • to more show what i need

    shipped date(user enter it) time dateof insert(server date)

    31/03/2015 8 pm 31/03/2015

    31/03/2015 10 pm 31/03/2015

    31/03/2015 1 am 01/04/2015

    31/03/2015 7 am 01/04/2015

    query above return 8 pm and 10 pm

    but not show 1 am and 7 am

    so taht what i need to show is 8 pm,10 pm,1 am,7 am

    only I need to show orderes that happen in same day and data shipped after 12 until 7 am

    Meaning if order still work two days i need to show it based on date starting in it

    we put 31/03/2015 in the day of 01/04/2015 because shipping date start in 31/03/2015

    but problem happen when order still work to another day

  • To really help we need some additional information. It would help if you could post the DDL (CREATE TABLE statement(s)) for the table(s) involved, some sample data (not production data) for each table involved (as INSERT INTO statements), and the expected results of the query.

    For help with this, please read the first article I reference below in my signature block regarding asking for help.

    Just from your two posts I am really not sure what you are trying to accomplish.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply