[SQL] Using variables in select

2011-08-12 Thread tlund79
Hi, Firstly; I'm not a developer, but a business developer and statistics guy. This means that I'm happy using "basic" selects to gather information for analysis. One thing that could really efficiate my work is using variables, let's say I have a table with different orders; |customer_id|produc

[SQL] Issue with a variable in a function

2011-11-08 Thread tlund79
I've created a function which purpose is to import data to an excel report. This is however the first time I'm doing this, and I've exhausted all other options before asking the question here. I call this function with this command: select ppr_data(2011,1,52,8) The issue relates to the variable "

Re: [SQL] Issue with a variable in a function

2011-11-09 Thread tlund79
18:28 To: Lund, Thomas Subject: Re: Issue with a variable in a function -Original Message- From: [hidden email] [mailto:[hidden email]] On Behalf Of tlund79 Sent: Tuesday, November 08, 2011 8:17 AM To: [hidden email] Subject: [SQL] Issue with a variable in a function The issue relates

Re: [SQL] Issue with a variable in a function

2011-11-09 Thread tlund79
I solved this one by trial and error. You were right I needed brackets to indicate an array, but also needed to replace "in ($4)" with "= any ($4)" -- View this message in context: http://postgresql.1045698.n5.nabble.com/Issue-with-a-variable-in-a-function-tp4974235p4977361.html Sent from the Pos

[SQL] Returning data from multiple functions

2011-11-10 Thread tlund79
A short brief about the goal: I have a Excel workbook loaded with static data and need to compare these to "live-data" from DB. There are 20 rows with data in the report that needs to be retrieved from the database, and almost the same amount of queries, since all of these queries relies on variabl

Re: [SQL] Returning data from multiple functions

2011-11-10 Thread tlund79
I know got this far thanks to Pavle Stehule. The function worked and returned the data when the variables was predefined after "return query". When tried to replace these with variables passed through the function call I got this message; ERROR: syntax error at or near "RETURN" LINE 1: ...ll sele