# Database Discussions > IBM DB2 >  Create one parameter field based on seperate date fields (month, day, year)

## donalejandro

Hello,

I am using Visual Studio 5 I have created a sql query from DB2 table - AS/400 (see below for code)  what I am trying to do is to just one parameter field instead of three separate fields.  Current I am using the following three separate parameter for date

ASOSOHM.OHORDM = 12   -  this field is for the month
ASOSOHM.OHORDD = 09   -  this field is for the day
ASOSOHM.OHORDY = 2013 - this field is for the year

ASOSOHM.OHORDM and ASOSOHM.OHORDD data type are decimals the length are 2,0 and default value is 0

ASOSOHM.OHORDY data type are decimals the length are 4,0 and default value is 0

All I want to do is to have one parameter for example input '12/9/2013' and get the results.  Can anyone advise me?  Thank you in advance.


SELECT COUNT(DISTINCT ASODTANNA.ASOSOHM.OHSON) AS InvoiceCount, ASODTANNA.ASOSOHM.OHORDM, ASODTANNA.ASOSOHM.OHORDD, 
                  ASODTANNA.ASOSOHM.OHORDY, 
                  CASE OHORDM WHEN 1 THEN 'January' WHEN 2 THEN 'February' WHEN 3 THEN 'March' WHEN 4 THEN 'April' WHEN 5 THEN 'May' WHEN 6 THEN 'June' WHEN 7 THEN 'July' WHEN
                   8 THEN 'August' WHEN 9 THEN 'September' WHEN 10 THEN 'October' WHEN 11 THEN 'November' WHEN 12 THEN 'December' ELSE 'N/A' END AS Period, 
                  ASODTANNA.ASOSMNM.SMNAM AS Processor, 
                  SUM(ASODTANNA.ASOSODM.ODORDQ * ASODTANNA.ASOSODM.ODUNTR + ASODTANNA.ASOSODM.ODTXAS + ASODTANNA.ASOSODM.ODTXAL + ASODTANNA.ASOSODM.ODTXAO)
                   AS Amount
FROM     ASODTANNA.ASOSMNM, ASODTANNA.ASOSOHM, ASODTANNA.ASOSODM, MEMDTANNA.MEMMST
WHERE  ASODTANNA.ASOSMNM.SMSMN = ASODTANNA.ASOSOHM.OHSMN1 AND ASODTANNA.ASOSOHM.OHSON = ASODTANNA.ASOSODM.ODSON AND 
                  ASODTANNA.ASOSOHM.OHSTM = MEMDTANNA.MEMMST."MMID#" AND (ASODTANNA.ASOSODM.ODSLN = 0) AND (ASODTANNA.ASOSMNM.SMSMNG = 'NSS') AND 
                  (ASODTANNA.ASOSOHM.OHORDM = 12) AND (ASODTANNA.ASOSOHM.OHORDD = 09)
GROUP BY ASODTANNA.ASOSOHM.OHORDM, ASODTANNA.ASOSOHM.OHORDY, ASODTANNA.ASOSMNM.SMNAM, ASODTANNA.ASOSOHM.OHORDD, 
                  ASODTANNA.ASOSMNM.SMSMNG
HAVING (ASODTANNA.ASOSOHM.OHORDY = 2013)

----------

