Re: [GENERAL] do I need a table function to do this

2012-12-30 Thread Sim Zacks
Do you have a unique key on site,variable? If not, what do you want in the treatment column if there are rows for both treatments X and Y or 2 Xs for a specific site and variable? If your data makes sense, you can pivot table t1 and then full

[GENERAL] do I need a table function to do this?

2012-12-29 Thread Kirk Wythers
I have been given an interesting problem to solve in a postgres db. I was given two tables t1: sitetreatment variableid (pk) - A X BLUE

[GENERAL] do I need a table function to do this

2012-12-29 Thread Kirk Wythers
I have been given an interesting problem to solve in a postgres db. I was given two tables t1: sitetreatment variableid (pk) - A X BLUE

Re: [GENERAL] do I need a table function to do this?

2012-12-29 Thread Serge Fonville
Hi, Assuming the columns in t2 are fixed, you should be able fairly easy solve this using a cursor. HTH Kind regards/met vriendelijke groet, Serge Fonville http://www.sergefonville.nl Convince Microsoft! They need to add TRUNCATE PARTITION in SQL Server

Re: [GENERAL] do I need a table function to do this

2012-12-29 Thread Bryan Lee Nuse
Hello Kirk, Is this even possible? It looks like if you could un-pivot your t2, then you could do a join between that result and t1 and have your desired table. Others may be able to suggest a more direct solution, but I've successfully adapted the one given here, with my own wide-format