James, Create a view, then use it in the CHOOSE
CREATE VIEW vwPickDate (CHI_SCHEDULE, chi_date, Choice, Entries) AS +
SELECT CHI_SCHEDULE, chi_date, count(*) +
FROM CHANGE1 GROUP BY chi_schedule, chi_date
CHOOSE vChoice FROM #VALUES FOR (CTXT(chi_date) & FORMAT(Entries,'999')) +
FROM vwPickDate WHERE chi_schedule = 185
James Hageman wrote:
I would like to use a CHOOSE to get distinct dates from a dataset and tell
me how many events are for a date in the CHOOSE is this possible.
I want to take this select and put it in a CHOOSE command.
SELECT ch1_date, COUNT(*) FROM CHANGE1 WHERE CH1_SCHEDULE = 185 GROUP BY
CH1_DATE
ch1_date COUNT (*)
---------- ----------
05/03/1993 11
05/10/1994 6
05/04/1995 5
05/07/1996 2
01/31/1997 1
05/12/1997 6
01/06/1999 1
05/07/1999 6
02/24/2000 1
04/13/2000 12
07/10/2001 3
04/29/2002 1
04/21/2003 2
05/25/2005 1
Something like :
CHOOSE var_date FROM #VALUES FOR ch1_date, COUNT(*) FROM CHANGE1 +
WHERE CH1_SCHEDULE = 185 GROUP BY CH1_DATE
???