Where Clause with Constant and Variable value (1 Viewer)

trackstar2786

Registered User.
Local time
Today, 10:58
Joined
Sep 19, 2017
Messages
11
What I'm trying to accomplish is to add constant footnote at the bottom of each output before it is exported in excel.

My current SQL statement without the footnote is below.

PHP:
strSQL = "Select Account, Reseller, [AT&T],Comcast, DataXoom, [Spectrum-TWC], [T-Mobile],[Verizon Wireless], [Verizon Wireline], Total  FROM summaryforrcs WHERE Account= " & rs!Account

My initial thought was to union to this query, but I'm having trouble getting my where clause to pick up that row "Disclaimer". I don't know if it's because 'Account' is a numeric value and Disclaimer is a text. If that is the issue i can always give a fake Account number and put my footnote string in the 'reseller' column of my union.

I think either way, I need help getting my where clause to still pick up the variable account as well as a static footnote.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 07:58
Joined
Aug 30, 2003
Messages
36,118
With a UNION query, you wouldn't need the WHERE clause to pick up both. You'd have two separate WHERE clauses

SELECT...
FROM...
WHERE...
UNION ALL
SELECT...
FROM...
WHERE...

You can use Null as a placeholder for the fields you won't be populating with the second SELECT:

SELECT Null, Disclaimer, Null, ...
 

trackstar2786

Registered User.
Local time
Today, 10:58
Joined
Sep 19, 2017
Messages
11
I was thinking about doing the union prior to the running of 'summaryforrcs' so that the footnote would already be apart of that query. Then when each account is broken out, it reads that specific account and also pulls the footnote line.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 07:58
Joined
Aug 30, 2003
Messages
36,118
Okay, post back if you get stuck. I don't know your data so I don't know if that's the approach or not.
 

Users who are viewing this thread

Top Bottom