Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Possible in one SELECT command?
Message
From
31/10/2005 15:56:58
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01063783
Message ID:
01063813
Views:
15
>Hi SQL gurus
>I have the following fields:
>CDate(D), CTime (C5), Patient (C30)
>As you may have understood, CDate holds dates, ctime times ( military ) and patient holds names.
>I am trying to get to the following, but since i think i may use only one UNION per select, i don't know if it's possible in one select command:
>
>CTime   Sunday    Monday   Tuesday    Wednesday
>-----   -------   ------   -------    ---------
>10:00   Sergio             Ken         Alfred
>10:15                                  Joseph
>10:15                                  Kim
>10:30   Fabio
>
>Well, you get the drill...
>
>TIA
>Jaime

Hi
* hypothesis : COUNT(DISTINCT CTime,DOW(CDate))<=1
SELECT ;
	CTime ;
,	MAX(IIF(DOW(CDate)=1,Patient,SPACE(30)))AS Sunday	; && ,CAST(NULL AS C(30)) if you want NULL
,	MAX(IIF(DOW(CDate)=2,Patient,SPACE(30)))AS Monday   ; && ,CAST(NULL AS C(30)) if you want NULL
,	MAX(IIF(DOW(CDate)=3,Patient,SPACE(30)))AS Tuesday  ; && ,CAST(NULL AS C(30)) if you want NULL
...
	FROM theTable;
	GROUP BY 1
* hypothesis : COUNT(DISTINCT CTime,DOW(CDate))>1
* ask me
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform