Professional Web Applications Themes

Ambiguous between two types of query - Microsoft SQL / MS SQL Server

Hello I'm ambiguous between two types of query. :) I want to show you two differen written query. Both of them do same job and both of them I can use without problem. But I want to choose the right one of them (I mean the performance issues, etc.). Thanks Omur Olmez Personal Table : code, pname, psurname Ordery Table : code_dealer, code_author select top 1 code_dealer, p1.psurname+' '+p1.pname as dealer_name, code_author, p2.psurname+' '+p2.pname as author_name from ordery left join personal p1 on p1.code=ordery.code_dealer left join personal p2 on p2.code=ordery.code_author select top 1 code_dealer, (select psurname+' '+pname from personal where ...

  1. #1

    Default Ambiguous between two types of query

    Hello

    I'm ambiguous between two types of query. :)

    I want to show you two differen written query. Both of them do same
    job and both of them I can use without problem. But I want to choose the
    right one of them (I mean the performance issues, etc.).

    Thanks
    Omur Olmez

    Personal Table : code, pname, psurname
    Ordery Table : code_dealer, code_author

    select top 1
    code_dealer,
    p1.psurname+' '+p1.pname as dealer_name,
    code_author,
    p2.psurname+' '+p2.pname as author_name
    from ordery
    left join personal p1 on p1.code=ordery.code_dealer
    left join personal p2 on p2.code=ordery.code_author

    select top 1
    code_dealer,
    (select psurname+' '+pname from personal where
    personal.code=ordery.code_dealer) as dealer_name,
    code_author,
    (select psurname+' '+pname from personal where
    personal.code=ordery.code_author) as author_name
    from ordery




    Ömür Ölmez Guest

  2. #2

    Default Re: Ambiguous between two types of query

    All we can say is: test them both and use whichever one performs better.
    There's a lot of good information at
    [url]http://www.sql-server-performance.com/default.asp[/url]

    HTH,
    Bob Barrows


    Ömür Ölmez wrote:
    > Hello
    >
    > I'm ambiguous between two types of query. :)
    >
    > I want to show you two differen written query. Both of them
    > do same job and both of them I can use without problem. But I want to
    > choose the right one of them (I mean the performance issues, etc.).
    >
    > Thanks
    > Omur Olmez
    >
    > Personal Table : code, pname, psurname
    > Ordery Table : code_dealer, code_author
    >
    > select top 1
    > code_dealer,
    > p1.psurname+' '+p1.pname as dealer_name,
    > code_author,
    > p2.psurname+' '+p2.pname as author_name
    > from ordery
    > left join personal p1 on p1.code=ordery.code_dealer
    > left join personal p2 on p2.code=ordery.code_author
    >
    > select top 1
    > code_dealer,
    > (select psurname+' '+pname from personal where
    > personal.code=ordery.code_dealer) as dealer_name,
    > code_author,
    > (select psurname+' '+pname from personal where
    > personal.code=ordery.code_author) as author_name
    > from ordery

    Bob Barrows Guest

  3. #3

    Default Re: Thank You



    Ömür Ölmez Guest

Similar Threads

  1. Replies: 0
    Last Post: January 12th, 04:57 PM
  2. ambiguous match found
    By Sam in forum ASP.NET Building Controls
    Replies: 3
    Last Post: August 18th, 09:08 AM
  3. query of queries and large data types
    By jim1234 in forum Coldfusion Database Access
    Replies: 1
    Last Post: May 12th, 06:38 PM
  4. query of quries and large data types
    By jim1234 in forum Coldfusion - Advanced Techniques
    Replies: 0
    Last Post: May 12th, 06:17 PM
  5. ouf newbe Column: 'nom' in field list is ambiguous
    By Québec in forum PHP Development
    Replies: 5
    Last Post: September 12th, 11:08 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139