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. query

query

Scheduled Pinned Locked Moved Database
databasehelptutorialquestion
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.
  • R Offline
    R Offline
    reza assar
    wrote on last edited by
    #1

    hi all i need to have a query that will retrieve two rows from one table for example : one table has two foreign key from one table ROWs of Tbl1 ------ 1) ID 2) UserId1 3) UserId2 what should i do?

    select
    [User].[FirstName],
    [User].[LastName],
    [User].[FirstName],
    [User].[LastName]
    From
    Tbl1 Join User on [UserId1]=[User].[Id] or [UserId2]=[User].[Id];

    please help me immediately

    G M 2 Replies Last reply
    0
    • R reza assar

      hi all i need to have a query that will retrieve two rows from one table for example : one table has two foreign key from one table ROWs of Tbl1 ------ 1) ID 2) UserId1 3) UserId2 what should i do?

      select
      [User].[FirstName],
      [User].[LastName],
      [User].[FirstName],
      [User].[LastName]
      From
      Tbl1 Join User on [UserId1]=[User].[Id] or [UserId2]=[User].[Id];

      please help me immediately

      G Offline
      G Offline
      Goutam Patra
      wrote on last edited by
      #2

      Join your User table 2 times 1 for UserID1 other for UserId2 Join User as b on [UserId1]=[b].[Id] Join User as c on [UserId1]=[c].[Id]

      1 Reply Last reply
      0
      • R reza assar

        hi all i need to have a query that will retrieve two rows from one table for example : one table has two foreign key from one table ROWs of Tbl1 ------ 1) ID 2) UserId1 3) UserId2 what should i do?

        select
        [User].[FirstName],
        [User].[LastName],
        [User].[FirstName],
        [User].[LastName]
        From
        Tbl1 Join User on [UserId1]=[User].[Id] or [UserId2]=[User].[Id];

        please help me immediately

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        Run profiler and see where the costs are!

        Never underestimate the power of human stupidity RAH

        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