Professional Web Applications Themes

query translation - PHP Development

Hi, I'm trying to translate from mysql to pgsql one query as below SELECT DISTINCT name FROM table ORDER BY surname Referring to mysql this query was working perfectly, however when I try use this query with pgsql I didn't achieve result What should I do? Why that query doesn't work correctly with pgsql? thanks in advance...

  1. #1

    Default query translation

    Hi,



    I'm trying to translate from mysql to pgsql one query as below



    SELECT DISTINCT name FROM table ORDER BY surname



    Referring to mysql this query was working perfectly, however when I try use
    this query with pgsql I didn't achieve result



    What should I do?

    Why that query doesn't work correctly with pgsql?



    thanks in advance


    gniewosh Guest

  2. #2

    Default Re: query translation

    On 2005-08-13 15-57-29 gniewosh <pl> wrote: 

    This should be a solution for THIS case:
    SELECT name FROM table ORDER BY surname GROUP BY name
     

    I'm not in Pg, so I am unable to answer this question, sorry. For the same
    reason, you should be careful with the solution I posted above, since there
    might be a much better solution.

    HTH (at least a little),
    Simon
    --
    Simon Stienen <http://slashlife.org/>
    "What you do in this world is a matter of no consequence,
    The question is, what can you make people believe that you have done."
    /Sherlock Holmes in A Study in Scarlet by Sir Arthur Conan Doyle/
    Simon Guest

  3. #3

    Default Re: query translation

    > This should be a solution for THIS case: 

    unfortunatelly this solution also doesn't work :(
    I prepared special script in php, which is removing the repeat record.

    thanks for your help


    gniewosh Guest

  4. #4

    Default Re: query translation

    On Sat, 13 Aug 2005 15:57:29 +0200, gniewosh wrote:
     
     
     
     

    I don't know pgsql either but try:

    SELECT DISTINCT table.name FROM table ORDER BY surname

    or

    SELECT table.name, table.surname FROM table ORDER BY table.surname

    or even

    SELECT name, surname FROM table ORDER BY surname

    It may be simply that you need to include "surnname" in your SELECT.

    Adam.
    Adam Guest

  5. #5

    Default Re: query translation

    Adam,
     

    the first query doesn't work :(
     
     

    The second and third even they are working they don't give me answers as I
    want.
    I would like to segregate particular records from one column according to
    order in second column as I wrote before.



    gniewosh Guest

  6. #6

    Default Re: query translation

    On 2005-08-14 08-26-52 Adam <com> wrote: 

    JFYI:
    SELECT name FROM foo;
    +--------+
    | name |
    +--------+
    | Monica |
    | Monica |
    | Peter |
    | Monica |
    | Anne |
    | Peter |
    +--------+

    SELECT DISTINCT name FROM foo;
    +--------+
    | name |
    +--------+
    | Monica |
    | Peter |
    | Anne |
    +--------+

    You can't archive this by just adding the surname to the result.

    HTH,
    Simon
    --
    Simon Stienen <http://slashlife.org/>
    "What you do in this world is a matter of no consequence,
    The question is, what can you make people believe that you have done."
    /Sherlock Holmes in A Study in Scarlet by Sir Arthur Conan Doyle/
    Simon Guest

Similar Threads

  1. Position translation
    By Suzan in forum Macromedia Exchange Dreamweaver Extensions
    Replies: 1
    Last Post: February 15th, 11:20 AM
  2. translation
    By Jeckert in forum Macromedia Freehand
    Replies: 2
    Last Post: April 20th, 02:44 AM
  3. Translation Patch?
    By Rík_Nascimento@adobeforums.com in forum Adobe Indesign Windows
    Replies: 4
    Last Post: June 19th, 12:50 PM
  4. Translation
    By Leen Koper in forum Adobe Photoshop Elements
    Replies: 11
    Last Post: July 23rd, 01:00 AM
  5. Translation with PERL?
    By A. Sinan Unur in forum PERL Miscellaneous
    Replies: 3
    Last Post: July 15th, 04:58 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