Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.postgresql > #784
| From | DFS <nospam@dfs.com> |
|---|---|
| Subject | Re: SQL command gives different result when done in function |
| Newsgroups | comp.databases.postgresql |
| References | <28abb49e-321a-45ac-9562-16f0bc301c46@googlegroups.com> |
| Message-ID | <Fr4XA.153997$se.145473@fx38.iad> (permalink) |
| Organization | blocknews - www.blocknews.net |
| Date | 2017-05-29 22:07 -0400 |
On 5/29/2017 5:07 AM, neojustebelmont@gmail.com wrote: > 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. You could hard-code the Primary Key value(s) which return for A. Will a VIEW do the job just as well?
Back to comp.databases.postgresql | Previous | Next — Previous in thread | Find similar
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