sql please assist me to display my data horizontal (1 Viewer)

TheSpecialist

New member
Local time
Today, 10:27
Joined
Sep 3, 2015
Messages
7
I want to know how can I turn a row into a column. I want my data to display in a horizontal way. Let me show you an example

Yourdate-------YourNumber------ Cash4Table ------YourTable----GaFiveTable
5/16/2016 312 Cash4Table

Currently, this is my SQL statement below along with the view

PARAMETERS [Enter Date:] DateTime, [Enter YourNumber:] IEEEDouble;
SELECT "YourTable" AS SourceTable, YourDate, YourNumber
FROM YourTable
WHERE YourDate BETWEEN [Enter Date:]-1 AND [Enter Date:]+1
UNION ALL
SELECT "Cash4Table", YourDate, YourNumber
FROM Cash4Table
WHERE YourDate BETWEEN [Enter Date:]-1 AND [Enter Date:]+1
UNION ALL
SELECT "GAFiveTable", YourDate, YourNumber
FROM GAFiveTable
WHERE YourDate BETWEEN [Enter Date:]-1 AND [Enter Date:]+1
UNION ALL SELECT "MoonPhaseTable", YourDate, YourNumber
FROM MoonPhaseTable
WHERE YourDate BETWEEN [Enter Date:]-4 AND [Enter Date:]+1
ORDER BY SourceTable, YourDate;

SourceTable YourDate YourNumber
Cash4Table 05/14/2015 8 8 0 4
Cash4Table 05/14/2015 3 7 4 9
Cash4Table 05/15/2015 3 5 3 1
Cash4Table 05/15/2015 3 7 4 7
Cash4Table 05/16/2015 2 0 4 7
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 10:27
Joined
Aug 30, 2003
Messages
36,126
Both posts moderated, both now approved.
 

sneuberg

AWF VIP
Local time
Today, 10:27
Joined
Oct 17, 2014
Messages
3,506
Have you tried a crosstab query? It's one of the Query Wizard options.
 

Users who are viewing this thread

Top Bottom