Re: [SQL] help in writing query

2008-06-10 Thread Osvaldo Rosario Kussama
maria s escreveu: I tried the query and it is returning result as , for a single entry in sample info in separate rows The result of the query as 1, prop1,value1 1,prop2,value2 2,prop1,value1 2 prop2,value2 2 prop3,value3 but i want the output as single row per sample id like 1,value1,value2

Re: [SQL] Data Comparison Single Table Question

2008-04-16 Thread Osvaldo Rosario Kussama
Bryan Emrys escreveu: I can handle this outside sql, but it seems like I should be able to do this in sql as well. 1 table: countries. 3 columns: id, name, price What I'm trying to get is a result of the price differences between every country. So if the data looks like (ignoring the id fie

Re: [SQL] finding columns that have three or fewer distinct characters

2008-03-05 Thread Osvaldo Rosario Kussama
Jeff Frost escreveu: I've got an interesting one...I'm trying to find columns that have three or fewer distinct characters (for example, "aa"). Wondering if I need to write a function or if someone has an idea how to do it with built in functions and/or pattern matching? I think the

Re: [SQL] ALL() question

2007-11-14 Thread Osvaldo Rosario Kussama
Julien Cigar escreveu: Hello, I have a problem with the ALL() subquery expression. I have three tables: - specimens - test_bits - specimen_test_bits The specimen_test_bits table contains two foreign keys, one to specimens(id), another to test_bits(id). Here is an output of specimen_test_bits

Re: [SQL] Simple Query?

2007-09-12 Thread Osvaldo Rosario Kussama
Koen Bok escreveu: I am doing some optimization on our search, but I need some advise... table: item idname -- 1iPod 2Zune 3Walkman table: search_item id_searchid_item -

Re: [SQL] problem join

2007-07-27 Thread Osvaldo Rosario Kussama
chester c young escreveu: having problem joining these correctly: schedule - cal_id references calendar not null - usr_id references users not null = unique( calZ_id, usr_id ) - result_no not null activity - cal_id references calendar not null - usr_id references users not null = unique( cal_id

Re: [SQL] Birth Day Calculation

2007-07-18 Thread Osvaldo Rosario Kussama
Ashish Karalkar escreveu: Hello All, I want to diplay all the name of persons who falls in between given day and month something like select name from my_table mt where mt.date_of_birth between 7-Jul and 15 - Aug column date_of_birth is of date type SELECT name FROM my_table mt

Re: [SQL] current_date / datetime stuff

2007-06-06 Thread Osvaldo Rosario Kussama
Kristo Kaiv escreveu: oneliner: select date_trunc('month',now()) + ((8 - extract('dow' from date_trunc('month',now()))||'days')::text)::interval; There is a problem when first monday is 1st or 2nd day of month. bdteste=# SELECT date_trunc('month',meses) + ((8 - extract('dow' from date_t

Re: [SQL] pg_dump inquiry

2007-03-01 Thread Osvaldo Rosario Kussama
Karthikeyan Sundaram escreveu: Hi, I have to dump only 10 tables out of 100 tables. In the pg_dump utility given by postgres there is an option called -t followed by table name. In that option, if I give more than 1 table, it's not accepting. How can I get the dump in one stroke fo

Re: [SQL] Syntax Error in COPY when “create function”

2007-02-27 Thread Osvaldo Rosario Kussama
hongliu zou escreveu: Am I forgetting some limitation? I get " ERROR: syntax error at or near "$1" SQL state: 42601 "with this CREATE FUNCTION Import1() RETURNS text AS $$ DECLARE path Char(100); BEGIN path = 'C:/zhl/hjs/anc_area.att'; COPY anc_areaAtt FRO

Re: [SQL] Sorting items in aggregate function

2006-09-12 Thread Osvaldo Rosario Kussama
Steven Murdoch escreveu: I would like to concatenate sorted strings in an aggregate function. I found a way to do it without sorting[1], but not with. Here is an example of a setup and what I could like to achieve. Does anyone have suggestions on what is the best way to get the desired result?

Re: [SQL] date arithmetic

2006-08-10 Thread Osvaldo Rosario Kussama
chrisj escreveu: Hi ALL, I want to do date arithmetic in SQL with a column that is integer. example create table bob ( col1 timestamp , col2 int4 ; where col2 represents a number of minutes. I want to do something like select col1 + interval col2 minutes from bob This is doable wi