Skip to main content
Participating Frequently
February 10, 2009
Question

Joining 2 cfqueries

  • February 10, 2009
  • 4 replies
  • 467 views
I'm trying to join 2 separate queries. One query is coming from a table that contains the property number and address. The other query is created by using QueryNew which contains property number and datelastmodified (cfdirectory). My goal is to run a query that displays all the property from the table with the last modified date of the jpg. The filename of the jpg is the same as the property number.

Example:

Property Number: Address: Photo Name: Date Photo Uploaded:
12345 (from table) 123 Main St (from table) 12345.jpg 02/09/2009 01:00PM (cfdirectory)
This topic has been closed for replies.

4 replies

tclaremont
Inspiring
February 11, 2009
So you want to join a field value in one table of "10000" with a field value of "10000.jpg"?

You might want to rethink your database design.
Participating Frequently
February 11, 2009
If the filename of a jpg is the same as the primary key in a table, how do I join those 2 together?

For example:

Query:
SELECT PROPID,ADDRESS FROM PROPERTY
Results:
10000 123 South Wacker St
10001 321 Halsted St

\Photos\
10000.jpg
10001.jpg

Sorry my last post wasn't clear...
Inspiring
February 11, 2009
quote:

Originally posted by: hanslim504
If the filename of a jpg is the same as the primary key in a table, how do I join those 2 together?

For example:

Query:
SELECT PROPID,ADDRESS FROM PROPERTY
Results:
10000 123 South Wacker St
10001 321 Halsted St

\Photos\
10000.jpg
10001.jpg

Sorry my last post wasn't clear...


When you select your photos, select the constant 1000000 as a joining field. Then loop through the results and change it to something that coincides with the photo. ListFirst looks promising. Then you can use the new value to join to your other query.
Inspiring
February 10, 2009
In addition to Adam's comments, if you are using cfdirectory, you probably don't need QueryNew.
Inspiring
February 10, 2009
> My
> goal is to run a query that displays all the property from the table with the
> last modified date of the jpg. The filename of the jpg is the same as the
> property number.

And an admirable goal it is.

How did it go?

I word it this way because you didn't actually ask a question in your post,
nor did you you indicate you had problems achieving your end, nor did you
show us any code which might have been giving you problems in arriving at
said goal.

So other than saying "yep, good idea", I don't actually know what you
expect anyone to say.

Can I buy a vowel?

--
Adam