dbTalk Databases Forums  

query translation

comp.databases.postgresql.questions comp.databases.postgresql.questions


Discuss query translation in the comp.databases.postgresql.questions forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
gniewosh
 
Posts: n/a

Default query translation - 08-13-2005 , 08:53 AM






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?



Reply With Quote
  #2  
Old   
Scott Auge
 
Posts: n/a

Default Re: query translation - 08-13-2005 , 10:01 AM






In article <ddku0h$cr6$1 (AT) nemesis (DOT) news.tpi.pl>,
"gniewosh" <news (AT) inso (DOT) pl> wrote:

Quote:
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?
Well, what result are you getting for the MySQL vs PostgreSQL?

Are you sure the same data set is in both databases?

--
Available for Hire! http://amduus.com/Resumes/


Reply With Quote
  #3  
Old   
gniewosh
 
Posts: n/a

Default Re: query translation - 08-13-2005 , 07:15 PM



Quote:
Well, what result are you getting for the MySQL vs PostgreSQL?
Are you sure the same data set is in both databases?
There is not a problem with data only with syntax of the sql language,
because as I written I have a query with is working perfectly in mysql. This
query is giving me a list of particular records from column name which are
ordered according to column surname. When I was try to use the same query
for pgsql I have problem, because the database never return me answer.







Reply With Quote
  #4  
Old   
Scott Auge
 
Posts: n/a

Default Re: query translation - 08-13-2005 , 10:12 PM



In article <ddm2fv$hkn$2 (AT) nemesis (DOT) news.tpi.pl>,
"gniewosh" <news (AT) inso (DOT) pl> wrote:

Quote:
Well, what result are you getting for the MySQL vs PostgreSQL?
Are you sure the same data set is in both databases?

There is not a problem with data only with syntax of the sql language,
because as I written I have a query with is working perfectly in mysql. This
query is giving me a list of particular records from column name which are
ordered according to column surname. When I was try to use the same query
for pgsql I have problem, because the database never return me answer.

Perhaps you need to add the field to the list of columns to return. I
have to say, when I sort on columns, it is always columns I plan to
display - so I have always had my ORDER BY in the column list of the
SELECT.

--
Available for Hire! http://amduus.com/Resumes/


Reply With Quote
  #5  
Old   
Luc Martineau
 
Posts: n/a

Default Re: query translation - 09-17-2005 , 11:35 AM





gniewosh wrote:
Quote:
Hi,



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



SELECT DISTINCT name FROM table ORDER BY surname

I got this on my postgreSQL database:


ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list

Then try
SELECT DISTINCT name, surname ORDER BY surname;

Regards



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.