Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Query with a list

New Here ,
Apr 07, 2008 Apr 07, 2008
Hi everyone.

I've been stressing over how to do this, and it is trivial, it seems, but I'm just not quite sure.

I need to create a report (Mostly just tables. I got those out of the way first), but the confusing part of the report is selecting what goes where.

The report looks like a table, with each cell containing the number of events that falls within it's category (rows denote one field, columns denote another). My question is how to do the query.

The tricky thing is, on this web page there has to be 5 of these tables. The data are shown in the tabled dependent on certain date values they hold. For example, I need one table for things that will occur in 30 or less days, one for 30-90 days, and one for 90+ days.

I already did the logic to get the ID's of every piece of data for each table. I stored them in 3 lists, NearIDs, MidIDs, and FarIDs.

Basically, I want to do this for each cell:

SELECT Count(IDs) AS #field1##field2#IDs
FROM NearIDs
WHERE #field1# = #field1# AND #field2# = #field2#

I don't think that I can do that, though. Any suggestions?

EDIT: Okay, ignore everything above if you'd like. I'd still like to know how to do this technique, but the question I really need answered is as follows.

I have a few dynamically named integer variables that I need to change. For a simplistic example, this is what I have:

<cfset AAA = 0>
<cfset AAB = 0>
<cfset ABA = 0>
etc...

Now I want to do this:

<cfset #uservariable1##uservariable2##uservariable3# = #uservariable1##uservariable2##uservariable3# + 1>

Where uservar1, uservar2, and uservar3 are all either A, B, or C etc... (Basically I don't need to worry about undefined characters).

How do I write the code that might change AAA to 1 when uservar 1 = A, uservar2 = A, uservar3 = A or change AAB to 1 when uservar1 = A, uservar2 = A and uservar3 = B.

Thanks again,

-Bull
264
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Apr 07, 2008 Apr 07, 2008
In answer to the 2nd part of your post:

<CFSET variables["#uservariable1##uservariable2##uservariable3#"] = variables["#uservariable1##uservariable2##uservariable3#"] + 1>

CR
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 07, 2008 Apr 07, 2008
LATEST
if you google "cross tab query" you might find some examples of how to do this with sql.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources