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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SQL query required

SQL query required

Scheduled Pinned Locked Moved Database
databasesalesquestion
3 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    Dear Friends, I got two tables: order and orderDetails Order table is:

    OrderId CustomerCode OrderDate
    1 55 2/12/2004
    2 55 3/12/2004
    3 56 4/15/2004
    4 57 4/16/2004

    OrderDetail table is:

    OrderId ProductId Quantity
    1 131 12 Litres
    1 157 13 KGs
    1 111 12 MT
    2 131 19 litres
    3 155 12 dozens

    I want SQL query such that: I want to print all the productId placed by customerCode 55 and orderdate i.e result contains following columns: CustomerCode, OrderDate, ProductId, Quantity For customer code 55. What can be the query ??

    R 1 Reply Last reply
    0
    • L Lost User

      Dear Friends, I got two tables: order and orderDetails Order table is:

      OrderId CustomerCode OrderDate
      1 55 2/12/2004
      2 55 3/12/2004
      3 56 4/15/2004
      4 57 4/16/2004

      OrderDetail table is:

      OrderId ProductId Quantity
      1 131 12 Litres
      1 157 13 KGs
      1 111 12 MT
      2 131 19 litres
      3 155 12 dozens

      I want SQL query such that: I want to print all the productId placed by customerCode 55 and orderdate i.e result contains following columns: CustomerCode, OrderDate, ProductId, Quantity For customer code 55. What can be the query ??

      R Offline
      R Offline
      raj_sarna
      wrote on last edited by
      #2

      does this sql statement help u in any way : Select CustomerCode, OrderDate, ProductId, Quantity From [Order] a Inner Join OrderDetails b On a.OrderID = b.OrderID Where a.CustomerCode = 55 Try not using Keywords for Table/Column names (like Order). Parshu

      C 1 Reply Last reply
      0
      • R raj_sarna

        does this sql statement help u in any way : Select CustomerCode, OrderDate, ProductId, Quantity From [Order] a Inner Join OrderDetails b On a.OrderID = b.OrderID Where a.CustomerCode = 55 Try not using Keywords for Table/Column names (like Order). Parshu

        C Offline
        C Offline
        Colin Angus Mackay
        wrote on last edited by
        #3

        parshu21 wrote: Try not using Keywords for Table/Column names (like Order). That's good advice - It can get confusing.


        "You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar Coming soon: The Second EuroCPian Event[^].

        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