5 Replies Latest reply on Feb 11, 2009 8:47 AM by Dan Bracuk

    Joining 2 cfqueries

    hanslim504
      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)
        • 1. Re: Joining 2 cfqueries
          Level 7
          > 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
          • 2. Re: Joining 2 cfqueries
            Dan Bracuk Level 5
            In addition to Adam's comments, if you are using cfdirectory, you probably don't need QueryNew.
            • 3. Re: Joining 2 cfqueries
              hanslim504 Level 1
              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...
              • 4. Re: Joining 2 cfqueries
                tclaremont Level 2
                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.
                • 5. Re: Joining 2 cfqueries
                  Dan Bracuk Level 5
                  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.