Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.postgresql > #782

SQL command gives different result when done in function

Newsgroups comp.databases.postgresql
Date 2017-05-29 02:07 -0700
Message-ID <28abb49e-321a-45ac-9562-16f0bc301c46@googlegroups.com> (permalink)
Subject SQL command gives different result when done in function
From neojustebelmont@gmail.com

Show all headers | View raw


Hello all.

I have an SQL command that is somewhere like

"SELECT value FROM table WHERE date = '2017-02-28' AND product_id = 100 LIMIT 1"

There are multiple rows if I don't use limit. But for convenience's sake, I'll say I get the value row to be "A"

Now I put that SQL into a function. And when the function is called, it instead gave out "C", which also fulfilled the date and product_id requirement.

Is there a way I could get "A" no matter what? Hopefully without adding extra WHERE clauses

Thank you.

Back to comp.databases.postgresql | Previous | NextNext in thread | Find similar


Thread

SQL command gives different result when done in function neojustebelmont@gmail.com - 2017-05-29 02:07 -0700
  Re: SQL command gives different result when done in function Dimitri Fontaine <dimitri.fontaine@schibsted.com> - 2017-05-29 11:20 +0200
  Re: SQL command gives different result when done in function DFS <nospam@dfs.com> - 2017-05-29 22:07 -0400

csiph-web