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. Database & SysAdmin
  3. Database
  4. SQL INNER JOIN

SQL INNER JOIN

Scheduled Pinned Locked Moved Database
helpdatabasetutorial
4 Posts 3 Posters 0 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.
  • W Offline
    W Offline
    walalawll
    wrote on last edited by
    #1

    I want to change following sql statement to using inner join but I dont know how to join on two column on the two table. Thanks for helping. select * from Persons A, Banks B where B.Student_ID = A.Student_ID AND B.class_NO = A.claa_NO when I change to the following statement, I get an error on the syntax. Incorrect syntax near the keyword 'ON'. select * from Persons A INNER JOIN B ON B.Student_ID = A.Student_ID ON B.class_NO = A.claa_NO Please kindly help. Thanks

    M E 2 Replies Last reply
    0
    • W walalawll

      I want to change following sql statement to using inner join but I dont know how to join on two column on the two table. Thanks for helping. select * from Persons A, Banks B where B.Student_ID = A.Student_ID AND B.class_NO = A.claa_NO when I change to the following statement, I get an error on the syntax. Incorrect syntax near the keyword 'ON'. select * from Persons A INNER JOIN B ON B.Student_ID = A.Student_ID ON B.class_NO = A.claa_NO Please kindly help. Thanks

      M Offline
      M Offline
      M Afzal Atta
      wrote on last edited by
      #2

      Try SELECT * FROM PERSONS A INNER JOIN BANK B ON B.STUDENT_ID = A.STUDENT_ID AND B.CLASS_NO = A.CLASS_NO

      W 1 Reply Last reply
      0
      • M M Afzal Atta

        Try SELECT * FROM PERSONS A INNER JOIN BANK B ON B.STUDENT_ID = A.STUDENT_ID AND B.CLASS_NO = A.CLASS_NO

        W Offline
        W Offline
        walalawll
        wrote on last edited by
        #3

        It works!!! Thank you very much

        1 Reply Last reply
        0
        • W walalawll

          I want to change following sql statement to using inner join but I dont know how to join on two column on the two table. Thanks for helping. select * from Persons A, Banks B where B.Student_ID = A.Student_ID AND B.class_NO = A.claa_NO when I change to the following statement, I get an error on the syntax. Incorrect syntax near the keyword 'ON'. select * from Persons A INNER JOIN B ON B.Student_ID = A.Student_ID ON B.class_NO = A.claa_NO Please kindly help. Thanks

          E Offline
          E Offline
          ednrgc
          wrote on last edited by
          #4

          You are not defining B as an alias.

          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