470,614 Members | 1,386 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,614 developers. It's quick & easy.

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?
Aug 13 '05 #1
4 2137
In article <dd**********@nemesis.news.tpi.pl>,
"gniewosh" <ne**@inso.pl> wrote:
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/
Aug 13 '05 #2
> 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.

Aug 14 '05 #3
In article <dd**********@nemesis.news.tpi.pl>,
"gniewosh" <ne**@inso.pl> wrote:
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/
Aug 14 '05 #4


gniewosh wrote:
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

Sep 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

39 posts views Thread by Chetan Raj | last post: by
3 posts views Thread by Paradigm | last post: by
1 post views Thread by Azzuron | last post: by
11 posts views Thread by lenygold via DBMonster.com | last post: by
reply views Thread by Stef Mientki | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.