Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. table joins--how to???

table joins--how to???

Scheduled Pinned Locked Moved XML / XSL
databasexmltutorialhelpquestion
6 Posts 4 Posters 6 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Marc Clifton
    wrote on last edited by
    #1

    Hi, I'm new to all this XML stuff, and I'm trying to figure out how I can code a table join like you can in SQL. Is this even possible with XML? I've got an XML file with 2 tables, and I'd like to perform a query where table1.id = table2.t1_id, for example. I've looked into XPath, and it doesn't seem like it can do the trick. Thanks! Marc Help! I'm an AI running around in someone's f*cked up universe simulator.

    M P P 3 Replies Last reply
    0
    • M Marc Clifton

      Hi, I'm new to all this XML stuff, and I'm trying to figure out how I can code a table join like you can in SQL. Is this even possible with XML? I've got an XML file with 2 tables, and I'd like to perform a query where table1.id = table2.t1_id, for example. I've looked into XPath, and it doesn't seem like it can do the trick. Thanks! Marc Help! I'm an AI running around in someone's f*cked up universe simulator.

      M Offline
      M Offline
      Michael A Barnhart
      wrote on last edited by
      #2

      Depends on what you are looking for. Using a transformation xslt and using the XPath select in which you match the child element (or attribute) value, in the select statement, can give you the relation. I.E. select table 1 first and then for each child entity run a select of table 2 with the value from table 1 as part of the select statement. If you just want to use some of the values of the initial element (table 1) you can pass those values with the param usage and then only perform the output in the second template.

      1 Reply Last reply
      0
      • M Marc Clifton

        Hi, I'm new to all this XML stuff, and I'm trying to figure out how I can code a table join like you can in SQL. Is this even possible with XML? I've got an XML file with 2 tables, and I'd like to perform a query where table1.id = table2.t1_id, for example. I've looked into XPath, and it doesn't seem like it can do the trick. Thanks! Marc Help! I'm an AI running around in someone's f*cked up universe simulator.

        P Offline
        P Offline
        Paul Watson
        wrote on last edited by
        #3

        Marc Clifton wrote: and I'd like to perform a query where table1.id = table2 XML Query[^] may be what you are looking for.

        Paul Watson
        Bluegrass
        Cape Town, South Africa

        Ray Cassick wrote: Well I am not female, not gay and I am not Paul Watson

        M 1 Reply Last reply
        0
        • P Paul Watson

          Marc Clifton wrote: and I'd like to perform a query where table1.id = table2 XML Query[^] may be what you are looking for.

          Paul Watson
          Bluegrass
          Cape Town, South Africa

          Ray Cassick wrote: Well I am not female, not gay and I am not Paul Watson

          M Offline
          M Offline
          Marc Clifton
          wrote on last edited by
          #4

          Yes! Thank you very much. I see that Microsoft has a managed source demo of XQuery. Looks like it might be the makings of an interesting article. Thanks again! Marc Help! I'm an AI running around in someone's f*cked up universe simulator.

          1 Reply Last reply
          0
          • M Marc Clifton

            Hi, I'm new to all this XML stuff, and I'm trying to figure out how I can code a table join like you can in SQL. Is this even possible with XML? I've got an XML file with 2 tables, and I'd like to perform a query where table1.id = table2.t1_id, for example. I've looked into XPath, and it doesn't seem like it can do the trick. Thanks! Marc Help! I'm an AI running around in someone's f*cked up universe simulator.

            P Offline
            P Offline
            Philip Fitzsimons
            wrote on last edited by
            #5

            <xsl:template match="//table2[table1/@id = @id]"> ... </xsl:template>


            "When the only tool you have is a hammer, a sore thumb you will have."

            M 1 Reply Last reply
            0
            • P Philip Fitzsimons

              <xsl:template match="//table2[table1/@id = @id]"> ... </xsl:template>


              "When the only tool you have is a hammer, a sore thumb you will have."

              M Offline
              M Offline
              Marc Clifton
              wrote on last edited by
              #6

              Ah ha. I've been reading up on XQuery vs. XSL, and I find it quite interesting (and quite obtuse). Thanks for this tidbit! Marc Help! I'm an AI running around in someone's f*cked up universe simulator.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups