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. Web Development
  3. how to use join query to merge order,customer,category and product table?

how to use join query to merge order,customer,category and product table?

Scheduled Pinned Locked Moved Web Development
databasemysqlsysadminsaleshelp
3 Posts 2 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.
  • Z Offline
    Z Offline
    zunisheikh
    wrote on last edited by
    #1

    SELECT ord.orderid,cus.custid,cus.custname,cat.catid,cat.catname,pro.proid,pro.proname from 'order' as ord inner join 'customer' as cus on cus.custid=ord.custid inner join 'category' as cat on cat.catid=ord.catid inner join 'product' as pro on pro.proid=ord.proid #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''order' as ord inner join 'customer' as cus on cus.custid=ord.custid inner join' at line 1

    P 1 Reply Last reply
    0
    • Z zunisheikh

      SELECT ord.orderid,cus.custid,cus.custname,cat.catid,cat.catname,pro.proid,pro.proname from 'order' as ord inner join 'customer' as cus on cus.custid=ord.custid inner join 'category' as cat on cat.catid=ord.catid inner join 'product' as pro on pro.proid=ord.proid #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''order' as ord inner join 'customer' as cus on cus.custid=ord.custid inner join' at line 1

      P Offline
      P Offline
      Peter Leow
      wrote on last edited by
      #2

      you cannot use 'order' as table name as it is a reserved word in mysql. But you can try using backticks ` to enclose it like these `order`, the backtick can be found on the top left hand side of your 101 keyboard. Do the same for the other tables.

      Z 1 Reply Last reply
      0
      • P Peter Leow

        you cannot use 'order' as table name as it is a reserved word in mysql. But you can try using backticks ` to enclose it like these `order`, the backtick can be found on the top left hand side of your 101 keyboard. Do the same for the other tables.

        Z Offline
        Z Offline
        zunisheikh
        wrote on last edited by
        #3

        thank u so mch :)

        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