Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2008
    Posts
    11

    Unanswered: Retrieving Data from 2 tables

    I have 2tables HD_Spare and HD_Asset
    HD_Spare contains
    SNo,serial_no,Model_No,Spare_Desc,Receiving_Id(FK) ,Asset_Type_Desc

    HD_Asset contains
    AssetId,Asset_Type_Desc,Model_No,Serial_No,Receivi ng_Id(FK),Spare_Desc

    Now i want to write a query when i select dropdown of Spares that results, Spare_Desc,Asset_Type_Desc,Serial_No,Model_No from Spares table and whern i select Dropdown of Asset that results Spare_Desc,Asset_Type_Desc,Serial_No,Model_No from Asset

    I dont know how to do this in a query
    Please help me out
    Last edited by rukhsar; 08-13-09 at 06:25.

  2. #2
    Join Date
    Jan 2008
    Posts
    11

    How to Retrieve data from 2 tables

    I have 2tables HD_Spare and HD_Asset
    HD_Spare contains
    SNo,serial_no,Model_No,Spare_Desc,Receiving_Id(FK) ,Asset_Type_Desc

    HD_Asset contains
    AssetId,Asset_Type_Desc,Model_No,Serial_No,Receivi ng_Id(FK),Spare_Desc

    Now i want to write a query when i select dropdown of Spares that results, Spare_Desc,Asset_Type_Desc,Serial_No,Model_No from Spares table and whern i select Dropdown of Asset that results Spare_Desc,Asset_Type_Desc,Serial_No,Model_No from Asset

    I dont know how to do this in a query
    Please help me out

  3. #3
    Join Date
    Oct 2006
    Location
    CA
    Posts
    210
    It's a little difficult to read all strung together without even space delimiters much less data types. Can you spare a little spacing and tabs when posting? Perhaps use the code box?

    I think the return from the query you want is just a straight extract from a single table, right? I'm a little confused since you're populating a drop-down box yet you're returning many columns. Usually a drop-down just has a description plus a key, but that's really beside the point. If all columns you want are contained in a single table then it doesn't get much simpler.

    First question I'd have is; are these production tables? They are badly normalized (Asset Type embedded in each row of both tables), linked together with descriptions rather than IDs, and the links go in both directions. The way I read it, for each spare you may have 0 or 1 asset and for every asset you may have 0 or 1 spare. Does that reflect reality?

Posting Permissions

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