-
Help SQL please
Hello,
I want a paramater box so when I open the my database I will be prompt to enter a moon phase number. Like 1 or .98, .99 etc
I keep getting a error with my sql script. I just want to be able to put in 1 or .98 and all the table I have below show me the 1 day before and 1 day after how I have below please assist me.
PARAMETERS [Enter YourNumber:] Number;
SELECT "MoonPhaseTable" AS SourceTable, YourDate, YourNumber
FROM MoonPhaseTable
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 "YourTable", YourDate, YourNumber
FROM YourTable
WHERE YourDate BETWEEN [Enter Date:]-4 AND [Enter Date:]+1
ORDER BY SourceTable, YourDate;
-
you don't do date math that way,
you use DateAdd ,or DateDiff
DateAdd("d",-1,[Enter Date]) and DateAdd("d",1,[Enter Date])
-
Hi I want it to operate like this below. I just want to use MoonPhase Number. The table below works I just want to use Moonphase Number when the box pops open
PARAMETERS [Enter Date:] DateTime;
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;
-
You should follow ranmans suggestion
-
"...then God replied, 'I sent 3 boats.' "
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules