SAP Business One Query: Customers Added Within a Certain Number of Days

By Mark Chinsky • February 11th, 2009

Query will prompt the user for a number of days and show the customers that were added within that number of days. Copy and paste into the Query Generator and run.
/*This query will return all customers that have been added to the system */
/*within the number of days selected by the user. Leaving the number of */
/*days blank will return all customers*/
/*Sorted by Days Added Ago Acending */
/*Parameter Definitions*/
/*SELECT FROM [dbo].[ODUN] T0*/
declare @Days as int
/* WHERE */
set @Days = /* T0.EffctAftr */ ‘[%0]‘
/*Main Query Definition*/
SELECT T0.CardCode as ‘Customer#’, T0.CardName, T0.CreateDate
,datediff (day,T0.CreateDate,GetDate()) as ‘Days Ago’
FROM OCRD T0
WHERE T0.CardType=’C’ and (@days = 0) or (GetDate() – @Days) <= T0.CreateDate
ORDER BY ‘Days Ago’
FOR BROWSE

Thanks to Ed Monk of SBONotes.com

  • Share/Bookmark

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

 

Leave a Comment

You must be logged in to post a comment.

« | Home | »