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

Comparing data, different datasources, output results

Explorer ,
Jan 04, 2008 Jan 04, 2008

Copy link to clipboard

Copied

Hi All,

I have two datasources, 1 contains "strHRimage","strImage" and 2nd contains "strHRimage".

I want to be able to compare the 2nd datasource "strHRimage" values with the 1st datasource "strHRimage" values and output the compared "strImage" values from the 1st datasource

strHRimage is a hi res image
strImage is a low res image

I'm afraid all my efforts have not worked, any examples would be greatfully received.

Regards

Trevor
TOPICS
Advanced techniques

Views

574

Translate

Translate

Report

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 ,
Jan 04, 2008 Jan 04, 2008

Copy link to clipboard

Copied

So are these two different datasources and not two tables in the same source?

If so, you have to query your second datasource to get the strHRimage values, then query your first datasource to find the appropriate matching records and get the strimage value. Do the records match with some sort of key, or just the strHRimage values?

Votes

Translate

Translate

Report

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
Community Beginner ,
Jan 04, 2008 Jan 04, 2008

Copy link to clipboard

Copied

Yes, the key is "key"...sorry for the pun.

The best way (that I know of) is to create 2 arrays--assuming that the keys are numeric--and comparing the 2 arrays. That way, it's only 2 SELECT queries to the DB and then CF processes comparision.

For ex,

Query #1:
arrayfirst[1] = John
arrayfirst[2] = Mary
arrayfirst[3] = Larry
...where 1,2,3 are keys from 1st query

Query #2:
arraysecond[1] = Ken
arraysecond[2] = Mary
arraysecond[3] = Larry
...where 1,2,3 are keys from 2nd query
Then compare...

Votes

Translate

Translate

Report

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
Explorer ,
Jan 04, 2008 Jan 04, 2008

Copy link to clipboard

Copied

In reply,

Yes they are two separate datasources/databases, and they have no "key"connection other than the values for string "strHRimage" being the same in both.

The second database is a feedback grabber from people downloading images from our site (I capture the highres image name).

I want to display 5+ lowres images (strImage) from the 1st database where the highres (strHRimage) image names match in each database.

Hope this helps.

Cheers

Trevor

Votes

Translate

Translate

Report

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 ,
Jan 04, 2008 Jan 04, 2008

Copy link to clipboard

Copied

google "coldfusion query of queries"

Votes

Translate

Translate

Report

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
Explorer ,
Jan 07, 2008 Jan 07, 2008

Copy link to clipboard

Copied

LATEST
Hi All,

Many thanks for your replies, I decided to manually enter in the lowres names by hand and update the code to capture the lowres image names for future use.

Cheers

Trevor

Votes

Translate

Translate

Report

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
Documentation