Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Help with Postgres

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Help!
View previous topic :: View next topic  
Author Message
pk_fox
LXF regular


Joined: Wed Apr 13, 2005 2:38 pm
Posts: 292
Location: Surrey, UK

PostPosted: Wed Mar 19, 2014 2:48 pm    Post subject: Help with Postgres Reply with quote

Hi all, I'm cutting my teeth with postgres and want some help with defining a function thst returns columns from various tables, I've googled for ages and can't find a simple answer, I have a query as shown below

Code:

CREATE OR REPLACE FUNCTION dbo.spgetallemployees() RETURNS SETOF ? AS
$BODY$SELECT
  employee.id,
  employee.firstname,
  employee.lastname,
  employee.city,
  employee.genderid,
  employee.dateofbirth,
  employee.departmentid,
  employee.createdate,
  employee.createuser,
  employee.amenddate,
  employee.amenduser,
  department.departmentname,
  genders.gendername
FROM
  dbo.employee,
  dbo.department,
  dbo.genders
WHERE
  employee.departmentid = department.departmentid AND
  employee.genderid = genders.genderid
ORDER BY
  employee.departmentid DESC;
$BODY$
LANGUAGE sql VOLATILE NOT LEAKPROOF
COST 100
ROWS 1000;


what do I need to specify in returns setof ?, this just works in other db's without specifying a type - all help gratefully appreciated
_________________
We can't stop here, this is bat country. Hunter S Thompson RIP.
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Help! All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast