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 Query Problem.

SQL Query Problem.

Scheduled Pinned Locked Moved Database
databasehelpquestion
2 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.
  • A Offline
    A Offline
    Asim N
    wrote on last edited by
    #1

    Hello, I have a problem building a query. There is a Master table with fields. ItemID[int][PK] Description1[text] Description2 [text] 1 "Any desc" "Any Desc" 2 " " " " and then there is a child table. ID[int] ItemID[int] CustomerID[int] 1 1 546 2 1 546 3 1 534 4 2 545 the two table are inner-joined with ItemID. I want to getthe data from two, but The Items selected should't repeat i.e. should be grouped by ItemID. I have problems in this bec Description fields are text in this case. So can anyone help me in this ? Looking forward to hearing from you. The problem is that i want to get just the Regards, Asim

    C 1 Reply Last reply
    0
    • A Asim N

      Hello, I have a problem building a query. There is a Master table with fields. ItemID[int][PK] Description1[text] Description2 [text] 1 "Any desc" "Any Desc" 2 " " " " and then there is a child table. ID[int] ItemID[int] CustomerID[int] 1 1 546 2 1 546 3 1 534 4 2 545 the two table are inner-joined with ItemID. I want to getthe data from two, but The Items selected should't repeat i.e. should be grouped by ItemID. I have problems in this bec Description fields are text in this case. So can anyone help me in this ? Looking forward to hearing from you. The problem is that i want to get just the Regards, Asim

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

      I don't know that I understand you correctly. You want to INNER JOIN the master and child table, but you don't want to repeat the ItemID (the join column) because it will return duplicate text columns? I am somewhat curious as to what format you want the data in. Performing joins tends to produce denormalised output and you cannot really get away from that. The best way that I can think of is to do two queries, one to join the tables but not return the text columns, and another to return just the text columns.


      My: Blog | Photos | Next SQL Presentation WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More

      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