Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2015
    Posts
    2

    Unanswered: Need help with SQL

    I have a table which looks like this:


    DetailID HeaderID DetailType DetailValue
    1 1 Name X
    2 1 ID 1
    3 1 Desegnation Developer
    4 2 Name Y
    5 2 ID 2
    6 2 City Manager
    7 3 Name Y
    8 3 ID 2
    9 3 City Admin
    I need to get the data in the below form from the table

    HeaderID Name ID Designation
    1 X 1 Developer
    2 Y 2 Manager
    3 Z 3 Admin

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Sorry, There is not enough info for us to help you. Please explain what you are trying to achieve.

    Andy

  3. #3
    Join Date
    Dec 2015
    Posts
    2

    Need help with SQL

    Alert me | Edit | Delete | Change type
    Question
    You cannot vote on your own post
    0
    Hi,

    I have two tables Header and Details

    Header looks like this:

    HeaderID Name Location DOB

    1 A Denver 03/08/1968

    2 B Denver 02/03/1961

    3 C Denver 02/03/1962

    Details Looks like this:

    DetailID HeaderID DetailType DetailValue
    1 1 Name X
    2 1 ID 1
    3 1 Desegnation Developer
    4 2 Name Y
    5 2 ID 2
    6 2 City Manager
    7 3 Name Z
    8 3 ID 3
    9 3 City Admin
    I need a query to search for all the values matching the criteria like this

    If I provide the input as City = Denver and Name = X and designation is Developer, it should retrieve something like this

    HeaderID HeaderName Name ID Designation
    1 A X 1 Developer
    If I provide the input as City = Denver and Name = Z and ID=3 and designation is Admin, it should retrieve something like this

    HeaderID HeaderName Name ID Designation
    1 C Z 3 Admin

  4. #4
    Join Date
    Dec 2007
    Location
    Richmond, VA
    Posts
    1,328
    Provided Answers: 5
    and what do you have so far. Most of us are not in the habit of doing someone's homework assignment for them. If you care to show what you have attempted and what your results were, some of us may be of the mindset to help you with some guidance. Otherwise let us know what its worth to you and we can discuss how to make your payment.
    Dave

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •