[SQL] query to return hourly snapshot

2006-04-04 Thread Richard Broersma Jr
I orginally sent this email to the [novice] list but did not get any response. I am look for help in developing a query that will return the nearest process record that was logged at or after each hour in a day (i.e. hourly snapshot). Below are typical sample data. Also, I've included a

Re: [SQL] query to return hourly snapshot

2006-04-04 Thread Richard Broersma Jr
Yes! Thanks you very much! --- Michael Fuhr <[EMAIL PROTECTED]> wrote: > On Tue, Apr 04, 2006 at 05:58:26PM -0700, Richard Broersma Jr wrote: > > I am look for help in developing a query that will return the nearest > > process record that was logged at or after ea

Re: [SQL] how to solve this problem

2006-04-13 Thread Richard Broersma Jr
Just a thought, Could you achieve that same result using the binary representation of an integer? Regards, Richard --- ivan marchesini <[EMAIL PROTECTED]> wrote: > Dear users, > I have this problem > > I have a table where there are 20 columns named > vinc1, vinc2, vinc3, vinc4, etc >

Re: [SQL] How To Exclude True Values

2006-06-05 Thread Richard Broersma Jr
wont complicate you query but it could simplfy your query by getting rid of the query nexting. Also, I haven't tested it. Basically, Replace the DISTINCT ON (t_inspect.inspect_id) construct with GROUP BY t_inspect.inspect_id HAVING t_inspect_result.inspect_result_pass = 'f' R

Re: [SQL] Advanced Query

2006-06-06 Thread Richard Broersma Jr
> Personally: I think your posts are getting annoying. This isn't SQLCentral. > Learn to write your own damn queries or even better - buy a book on SQL... Personally: (being a newbie with an interest in developing a strong rdms skillset) I've enjoyed following threads like these. Even when the q

Re: [SQL] How To Exclude True Values

2006-06-06 Thread Richard Broersma Jr
, 2, f > 3, 5, f > *4, 8, f* -- the only one i really want >From your sample it seems to me that you are really only looking for the most >recient occuring record that have produced a false test regardless of which Inspect_id or inspect_result_id it came from. Is this

Re: [SQL] How To Exclude True Values

2006-06-06 Thread Richard Broersma Jr
ir_id testmstamp 4 8 No 6/5/2006 8:00:00 AM Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

Re: [SQL] How To Exclude True Values

2006-06-06 Thread Richard Broersma Jr
> Richard, that is the result i would need given that > data set. i have to digest this version, though. > > should this query be more efficient than the subquery > version as the table starts to get large? My experience is that Distinct On queries do not preform as well as their group by count

Re: [SQL] How To Exclude True Values

2006-06-07 Thread Richard Broersma Jr
t_inspect_result.inspect_id ) AS b on a.inspect_result_timestamp = b.mstamp ; Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] How To Exclude True Values

2006-06-07 Thread Richard Broersma Jr
ter next time. > > thanks for the help. I am surprised that the query did not work the first time without the optional AS keyword. I would be interested in knowing why your server requires the AS and mine doesn't. Regards, Richard Broersma Jr. ---(end of broa

Re: [SQL] How To Exclude True Values

2006-06-07 Thread Richard Broersma Jr
> i think i've figured out the gist of the thought > process behind the SQL query... > > 1. select everything from t_inspect_result as table a > 2. select max timestamp value entries in > t_inspect_result as table b > 3. choose only choose those rows where the max > timestamps of table a and b are

Re: [SQL] Query to return modified results at runtime?

2006-06-07 Thread Richard Broersma Jr
> IDColor > --- --- > 1 Blue > 2 Red > 3 Green > 4 Orange > > How would I rewrite the query to return results where the colors are > replaced by letters to give the following results? > > IDColor > --- --- > 1 A > 2 D > 3 B > 4 C http://www.p

Re: [SQL] Finding multiple events of the same kind

2006-06-11 Thread Richard Broersma Jr
ipants.person_fk HAVING > > count(participants.person_fk) > 1 > > That worked like a charm! Thank you very much! > -- Also, you could create a unique column constraint that would prevent multiply instances of the same person in the participants table. Regards, Richard Broersm

Re: [SQL] COPY to table with array columns (Longish)

2006-06-12 Thread Richard Broersma Jr
a good choice when the data comes naturally segmented. > Also, for a case and point, some of the postgresql system tables use arrays. I suppose that these would be examples were the core develops felt arrays were a good fit. Regards, Richard Broersma Jr. --

Re: [SQL] Repetitive code

2006-06-16 Thread Richard Broersma Jr
s how postgresql supports materialized views or if it just shows how to simulate a materialized view with procedural code. Either way, I thought it might be of interest to you. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 4: Have you s

[SQL] any additional date_time functions?

2006-06-17 Thread Richard Broersma Jr
n variable increments i.e.: 5, 10, or 15 minutes increments, 3, 4, 6 hour increments, 1, 2 weekly increments, I imagine that the returned values would have to either be the "floor" or "ceiling" of the actual time stamps. Regards, Richard Broersma Jr. --

Re: [SQL] any additional date_time functions?

2006-06-18 Thread Richard Broersma Jr
esents some number of your intervals offset from an epoch. Bruno, Thanks for the suggestions. I am going to "toy" around with them to see what I can get to work. Thanks for the help. Regards, Richard Broersma Jr. ---(end of broadcast)---

Re: [SQL] How to get a result in one row

2006-06-21 Thread Richard Broersma Jr
there was a solution with pre-existing aggregates. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly

Re: Fwd: [SQL] Start up question about triggers

2006-06-22 Thread Richard Broersma Jr
resql.org/docs/8.1/interactive/plpgsql-trigger.html Hope this is what you are looking for. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

Re: Fwd: [SQL] Start up question about triggers

2006-06-23 Thread Richard Broersma Jr
l_col2 TG_WHEN : TG_RELNAME : current_user : TG_OP : old.tbl_col3 TG_WHEN : TG_RELNAME : current_user : TG_OP : old.tbl_coln is this something like what you had in mind? Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: Fwd: [SQL] Start up question about triggers

2006-06-26 Thread Richard Broersma Jr
your finial goal is just to achieve db server replication, wouldn't slony achieve what you want? Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: Fwd: [SQL] Start up question about triggers

2006-06-27 Thread Richard Broersma Jr
ucts/mammothreplicator Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] i need solution to this problem

2006-06-28 Thread Richard Broersma Jr
it seems that emp_table references personal_table on personal_no = per_no. But it is not clear how this is the case when personal_no is an integer and per_no is a varchar. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 9: In versi

Re: [SQL] SELECT Aggregate

2006-06-28 Thread Richard Broersma Jr
d on this list,I can suggest a possible solution that I've seen. It might work for your problem. Of course, I haven't tested anything like this and don't know if PostgreSQL supports it. Just be sure that trans_no is unique in the returned query. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] SELECT Aggregate

2006-06-28 Thread Richard Broersma Jr
using fiscalyeartable2_pkey on fiscalyeartable2 f2 (cost=0.00..5.82 rows=1 width=4) (actual time=0.008..0.009 rows=1 loops=4) Index Cond: ($0 = fiscalyear) Total runtime: 0.138 ms (5 rows) it works, and check

Re: [SQL] Using In Clause For a Large Text Matching Query

2006-06-29 Thread Richard Broersma Jr
where t1.col1 like '%' || fd1.samplecol || '%' ; This is just an idea. I've never used split_part or developed a sudo join this way. But it may work provided you and jump your text files into a temp table. Notice: http://www.postgresql.org/docs/8.1/interactive/functions-string.ht

Re: [SQL] Using In Clause For a Large Text Matching Query

2006-06-29 Thread Richard Broersma Jr
ould build a regex for each and feed them in an array to an '~ ANY' > expression like so (or, > use ~* for case > insensitive matching): > > SELECT col1 > FROM table > WHERE col1 ~ ANY (ARRAY['regex1', 'regex2', ...]); Good point, But don

Re: [SQL] SELECT Aggregate

2006-06-29 Thread Richard Broersma Jr
> I've tried Aaron's suggestion of the GROUP BY and I don't know much about > it, but it ran for around 17 hours and still going (it had a dedicated Dual > Xeon 3.0GHz box under RHEL4 running it!) Maybe, this query that you are trying to run is a good candidate for a "Materialize View". http://ar

Re: [SQL] SELECT Aggregate

2006-06-29 Thread Richard Broersma Jr
asure of maintance would be to re-index the database. All of this is listing in the postgresql manual. If you really want to ensure the best possible speeds, it will be an important step to take. Regards, Richard Broersma Jr. ---(end of broadcast)

[SQL] Alternative to Select in table check constraint

2006-06-30 Thread Richard Broersma Jr
I am practicing with SQL examples comming from the book: JOE CELKO'S SQL PUZZLES & ANSWERS The following codes doesn't work on PostgreSQL 8.1.4 but according to the book does conform to SQL-92. Is there any other solutions that would result in the same effect? Or is this an example of a contr

Re: [SQL] How To Exclude True Values

2006-06-30 Thread Richard Broersma Jr
t1.id_i, t1.ir_id, t1.test, t1.stamp, t1.inttest from test as t1 where t1.stamp = ( select max(T2.stamp) from test as t2 where t2.id_i = t1.id_i) and t1.test = 'f'; Regards, Richard Broersma Jr. ---(end of broadcast)--

Re: [SQL] Alternative to Select in table check constraint

2006-06-30 Thread Richard Broersma Jr
ed), how would would it be possible to change the active status from one badge to another? Oh well, partial index are obvious the superior solution since the entire table doesn't not have to be scanned to determine if the new badge can be set to active. Once again thanks for the

Re: [SQL] Alternative to Select in table check constraint

2006-06-30 Thread Richard Broersma Jr
timize particular cases but > it's not easy to see how the machine might figure it out for arbitrary > SELECTs. > > The unique-index hack that Michael suggested amounts to hand-optimizing > the sub-SELECT constraint into something that's efficiently checkable. > >

Re: [SQL] Left join?

2006-07-01 Thread Richard Broersma Jr
defun) left join func as CD on (R1.codate=CD.codefun) left join func as CF on (R1.codfec=CF.codefun) ; Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [SQL] Alternative to Select in table check constraint

2006-07-02 Thread Richard Broersma Jr
> On Fri, 2006-06-30 at 18:41 -0700, Richard Broersma Jr wrote: > > > > CHECK ( 1 = ALL ( SELECT COUNT(STATUS) > > > > FROM BADGES > > > > WHERE STATUS = 'A' >

Re: [SQL] Alternative to Select in table check constraint

2006-07-02 Thread Richard Broersma Jr
the same time. But is also gives you a > history of badges and their activities. Good point. I take it that this type of solution stems from temporal schema design. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Can't drop table

2006-07-02 Thread Richard Broersma Jr
t also hangs when I try to alter the table. > Just don't understand the problem here. > Any help will be highly appreciated. You might want to post this on the PG_General Mailing list of you do not get many responses. Regards, Richard Broersma Jr. ---(end of bro

Re: [SQL] hi i need to connect database from my system to another system

2006-07-03 Thread Richard Broersma Jr
t-authentication.html#AUTH-PG-HBA-CONF Also, secure shell also works well when connecting from another system. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] hi i need to connect database from my system to another system

2006-07-03 Thread Richard Broersma Jr
my meager experience and knowledge. ;-) To start off with, it would be helpful to know which OS version of PostgreSQL you are using. The windows versions is pre-configured to start with the "-i" option for allowing TCP/IP connections. Secondly, how are you trying to connect to yo

Re: [SQL] hi i need to connect database from my system to another

2006-07-03 Thread Richard Broersma Jr
ect. This should get you connected. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] i have a problem of privilages

2006-07-04 Thread Richard Broersma Jr
SQL syntax for assigning privileges is found here: http://www.postgresql.org/docs/8.1/interactive/ddl-priv.html Also finding these topic is very easy also. Simple scan over the table of contents of the manual: http://www.postgresql.org/docs/8.1/interactive/index.html And of-c

Re: [SQL] create aggregate function 'count_bool( column_name, boolean )'

2006-07-07 Thread Richard Broersma Jr
elect count(purchased) from some_table as A2 where purchased=true and A1.product_id=A2.product_id ) as TP, ( select count(selected) from some_table as A3 where purchased=true and A1.product_id=A3.product_id ) as TS from some_table as A1 group by product_i

Re: [SQL] SELECT substring with regex

2006-07-07 Thread Richard Broersma Jr
your_string, ' ')+1) suffix: substr(your_string, length(your_string)-strpos(your_string, ' '), length(your_string)) Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

[SQL] Celko's Puzzle Number 5

2006-07-07 Thread Richard Broersma Jr
"masks" could be used to enforce a kind of tagging convention like 'AA4', 'BB5'. Has anyone seen or done anything like this before? I am interested to hear what kind of solutions there are. Regards, Richard Broersma Jr. ---(end o

Re: [SQL] table joining duplicate records

2006-07-08 Thread Richard Broersma Jr
survey app? What duplicates? You have two unique answers for question1. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 2: Don't 'kill -9' the postmaster

Re: [SQL] Celko's Puzzle Number 5

2006-07-08 Thread Richard Broersma Jr
> > Unfortunately, even though SIMILAR TO has been standard SQL for > several years, not all databases implement it. Many databases > do support regular expressions but generally via a non-standard > syntax (as PostgreSQL does with its ~, ~*, !*, and !~*

Re: [SQL] table joining duplicate records

2006-07-08 Thread Richard Broersma Jr
r2 hmmm.. I am no sure that you are going to get what you want from a simple select query. A reporting software could do this easily however. also be sure to include the list in your replies :-). Regards, Richard Broersma Jr. ---(end of broadcast)

Re: [SQL] MS-SQL<->Postgres sync

2006-07-10 Thread Richard Broersma Jr
gt; allow you to connect via ODBC to another database and feed data back and > forth. I think there are add on modules for PostgreSQL but I have not tried > to have PostgreSQL talk to other databases before. I am not sure if this applys directly to the problem here, but this link my be u

Re: [SQL] How to find entries missing in 2nd table?

2006-07-11 Thread Richard Broersma Jr
> > > I need to get all entries from the table control that are not listed in > datapack. SELECT C.CONTROLLER_ID FROM CONTROL AS C LEFT JOIN DATAPACK AS D ON ( C.CONTROLLER_ID = D.CONTROLLER_ID) WHERE D.CONTROLLER_ID IS NULL; Regards, Richard B

Re: [SQL] How to find entries missing in 2nd table?

2006-07-11 Thread Richard Broersma Jr
--- Richard Broersma Jr <[EMAIL PROTECTED]> wrote: > > >> I need to get all entries from the table control that are not listed in > > >> datapack. > > > > > > SELECT C.CONTROLLER_ID > > > > > > FROM CONTROL AS C >

Re: [SQL] How to find entries missing in 2nd table?

2006-07-13 Thread Richard Broersma Jr
my experience, it does not preform as well as the standard group by >clause. I noticed a ~20% increase in query run times. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [SQL] How to find entries missing in 2nd table?

2006-07-13 Thread Richard Broersma Jr
simple not needed for the query to preform correctly. The additional group by clause in the second query could cause it to preform additional processing which "may" cause it to preform slower. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] Table Join (Maybe?)

2006-07-19 Thread Richard Broersma Jr
y display state total. Then if the report footer you could add a grand total summary for all of the records you passed to the report. The following link show some of the reporting programs that you can use. http://www.postgresql.org/community/survey.43 Regards, Richard Broersma Jr. --

Re: [SQL] User Permission

2006-07-19 Thread Richard Broersma Jr
7/msg00148.php Apparently, whatever privileges 'pubic' has are extended to the privileges of the individual users. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] Error when trying to use a FOR loop

2006-07-20 Thread Richard Broersma Jr
docs/8.1/interactive/sql-createlanguage.html The following link gives a shot list of languages that you can use. There are others however: http://www.postgresql.org/docs/8.1/interactive/server-programming.html see Server-side Procedural Languages from: http://www

Re: [SQL] Help with privilages please

2006-07-20 Thread Richard Broersma Jr
th earlier compatibility. Is there away I can overcome this. A simple dump/restore does not solve theproblem. You might also have to revoke all from public: Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] simple problem???

2006-07-20 Thread Richard Broersma Jr
cord. maybe this will work; select a,b,c from table as T1 join (select a, min(c) as minc from table group by a) as T2 on (t1.a = t2.a) and (t1.c = t2.c) ; Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 4: Have you s

Re: [SQL] How to use table from one database to another

2006-08-02 Thread Richard Broersma Jr
ell For this functionality to work you will need the db-link add on for postgresql. http://pgfoundry.org/projects/snapshot/ Also for other useful addons check out the project tree. http://pgfoundry.org/softwaremap/trove_list.php Regards, Richard Broersma Jr. ---(end of broa

Re: [SQL] Query response time

2006-08-08 Thread Richard Broersma Jr
may want to reindex you db in order to clean all of the dead tuples from your indexs. For heavy insert/update queries check your postgres logs to see if any messages suggest increasing your check-point-segments. If this is the case, try increasing you check_point_segments and

Re: [SQL] Best way to do this query..

2006-08-25 Thread Richard Broersma Jr
ld also reduce your query processing time by limiting the data ranges for your existing query to something for reasonable. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate

Re: [SQL] Best way to do this query..

2006-08-25 Thread Richard Broersma Jr
4?ie=UTF8 Another alternative is to create a materialized view that will update itself only when records are inserted or updated. http://jonathangardner.net/PostgreSQL/materialized_views/matviews.html Regards, Richard Broersma Jr. ---(end of

[SQL] Create Assertion -- Question from a newbie

2006-08-27 Thread Richard Broersma Jr
ieved by other means? (i.e. alternative schema definitions or triggers?) Or does it merely provide a redundant means to constrain data, and thereby not warrant addition into the features of PostgreSQL? Regards, Richard Broersma Jr. ---(end of broadcast)

Re: [SQL] Create Assertion -- Question from a newbie

2006-08-27 Thread Richard Broersma Jr
r. Thanks for the feed back. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] Fastest way to get max tstamp

2006-08-28 Thread Richard Broersma Jr
> name | program | effective | tstamp | rate > --+-+++-- > jdoe | AAA | 2006-07-01 | 2006-07-16 23:42:13.809214 | 20 > jdoe | BBB | 2006-07-01 | 2006-07-16 23:42:13.809214 | 20 > jdoe | AAA | 2006-08-16

Re: [SQL] where clause subqueries vs multiple rows results

2006-09-10 Thread Richard Broersma Jr
> I've a query which I'd have liked to word akin to: > > SELECT guid FROM child WHERE the_fkey = > ( SELECT id FROM parent WHERE name ~ 'some_regex' ) > ORDER BY the_fkey, my_pkey; > > I got around it by doing the SELECT id first, and then doing a SELECT > guid for each row re

Re: [SQL] How to autoincrement a primary key...

2006-09-22 Thread Richard Broersma Jr
QUENCE foo START 1; CREATE TABLE bar (id integer PRIMARY KEY DEFAULT nextval('bar')); Also see: http://www.postgresql.org/docs/8.1/interactive/sql-createtable.html http://www.postgresql.org/docs/8.1/interactive/sql-createsequence.html Regards, Richard Broersma Jr.

Re: [SQL] conversion of numeric field from MSSQL to postgres

2006-10-20 Thread Richard Broersma Jr
erhaps someone else is resending these email? Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] conversion of numeric field from MSSQL to postgres

2006-10-20 Thread Richard Broersma Jr
em. I was surprised to see your name in a man pages for other command line utilities un-related to postgresql. So I would expect that you have enough to do in the mean time besides altering the moderation software. :-) Regards, Richard Broersma Jr. ---(end of broadcast)-

Re: [SQL] [HACKERS] Bug?

2006-10-21 Thread Richard Broersma Jr
active/datatype.html#DATATYPE-SERIAL Also, if you are interested in resetting your columns "serial" value back to 1 or 0 or -1, you can do it using the setval() function for the following link: http://www.postgresql.org/docs/8.1/interactive/functions-sequence.html Regards, Ric

Re: [SQL] delete on cascade

2006-10-23 Thread Richard Broersma Jr
t; now, without redeclaring the table? > Thanks very much for helping me. This link has one line that is very similar to what you want to do. You will probably have to start a transaction, drop the foriegn key contraint and then add a new foriegn key contraint with the on drop cascade . http:/

Re: [SQL] delete on cascade

2006-10-23 Thread Richard Broersma Jr
i guess my first attempt to send a reply failed. --- Richard Broersma Jr <[EMAIL PROTECTED]> wrote: > > Hi all, > > I guess this is an already asked question, but I didn't found an answer, so > > apologize me. Imagine I've got two tables: > > skill(id,d

Re: [SQL] Add calculated fields from one table to other table

2006-10-26 Thread Richard Broersma Jr
avg(price) as avg_price, avg(volume) as avg_volume from ticker where time between 'yourstartdate' and 'yourenddate' group by tick, minute; Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] How to query information schema from shell script

2006-10-27 Thread Richard Broersma Jr
t; Again, thanks for the help. psql -l Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] Case Preservation disregarding case sensitivity?

2006-10-28 Thread Richard Broersma Jr
r a way (magic, patches, whiskey, etc) that will give > me > case-preservation with EITHER case-sensitivity OR case-insensitivity, but not > both as I am seeing. Perhaps in your queries or views you use the AS keywork to respecify the column name with upper/

Re: [SQL] Case Preservation disregarding case sensitivity?

2006-10-28 Thread Richard Broersma Jr
oo should be equivalent to "FOO" not "foo" according to the standard. If you want to write portable applications you are advised to always quote a particular name or never quote it.) ... Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Add calculated fields from one table to other table

2006-10-29 Thread Richard Broersma Jr
re interested in and outer join that to your actual table. This will give you a count of zero. i.e. select S.minute, count(W.minute) as minutecnt from Series_of_Minutes S left join Working_table W on S.minute = W.minute ; hope this helps. REgards, Richard Broersma jr. ps. sorry that my quer

Re: [SQL] Add calculated fields from one table to other table

2006-10-30 Thread Richard Broersma Jr
n-joined tables contrainst AND A.id2 < C.id2 ; --in the where clause I hope this helps. Regards, Richard Broersma JR. ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate sub

Re: [SQL] Add calculated fields from one table to other table

2006-10-31 Thread Richard Broersma Jr
> Thanks for your help. That does make sense, but I am not able to get the > result what I wanted > exactly. Let me explain you. > > I have ticks table in which I have columns like ric, tick_time, price & > volume. The times > table has just one column with times_time which has time data

Re: [SQL] Add calculated fields from one table to other table

2006-10-31 Thread Richard Broersma Jr
> Hi Richard, > > Thanks a lot. I still am not able to get the result for all the rics in the > ticks table but I > am able to get the result for a particular ric. > > Can you help me with getting the result for all the rics in the ticks table > > Thanks > Roopa Could you send

Re: [SQL] Add calculated fields from one table to other table

2006-11-02 Thread Richard Broersma Jr
GROUP BY A.ric, A.minute ORDER BY A.minute ; Hope this is what you were looking for. This is the first time I've ever had to employ a cross join get what I wanted. Just realize that this query will explode with a very large number to records returned as the times

Re: [SQL] Duplicate Fields + Views Questions

2006-11-03 Thread Richard Broersma Jr
OM gnis_international_view, > gnis_usa_view; > ERROR: column "the_geom" duplicated > ERROR: column "the_geom" duplicated > > Any ideas on how I can achieve what I am seeking Yes but you will have to specify each column name from each table and create alias

Re: [SQL] a celko-puzzle from long time ago

2006-11-06 Thread Richard Broersma Jr
s that describe how to set parameter variables before executing a query that uses them. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to

Re: [SQL] Groups and Roles and Users

2006-11-06 Thread Richard Broersma Jr
ql.org/docs/8.1/interactive/user-manag.html http://www.postgresql.org/docs/8.1/interactive/client-authentication.html Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] fetching unique pins in a high-transaction environment...

2006-11-06 Thread Richard Broersma Jr
ross transactions or even user sessions. I was curious of the datatype for pin, in the previous example I think that it was defined as a varchar. Perhaps casting the sequence to a varchar would be the finial step before updating/inserting the records. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Requirement for PostgreSQL Database Developer

2006-11-06 Thread Richard Broersma Jr
Thanks for I think the list that you are looking for is: [EMAIL PROTECTED] --- Mark <[EMAIL PROTECTED]> wrote: > > Hi , > > > Location: San Diego, CA [You can also TeleCommute...] > > Duration: 6+ months. > > > > This is Mark with ProV International, This email is in regards to

Re: [SQL] converting Informix outer to Postgres

2006-11-06 Thread Richard Broersma Jr
nv_id = i.id and > --mdef2.id = im2.milestone_id and > im1.datereceived IS NULL Is there a reason that these two lines are commented out in the postgresql query? Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] PostgesSQL equivalent of the Oracle 'contains' operator

2006-11-10 Thread Richard Broersma Jr
an a like. Have you looked at the contrib module tsearch2? http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/ Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subs

Re: RES: [SQL] Inserting data in composite types!

2006-11-13 Thread Richard Broersma Jr
> Thanks, It works! I have tried: > > insert into employee (c, nome, sal) values(1, 'emp name', '(1, (01/01/2000, > 01/01/2000))' ); > > And it doesn't work! What is the error message? Regards, Richard Broersma Jr. -

Re: [SQL] Another question about composite types

2006-11-13 Thread Richard Broersma Jr
ve do it ? Why not use a conventional table to hold this information that references your employee table? Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [SQL] unexpected EOF within message length word

2006-11-14 Thread Richard Broersma Jr
> I'm having trouble getting the Windows ODBC drivers to work. They used > to work, but it's been 6 months or so. If you don't find the answer you are looking for on this list, maybe try: [EMAIL PROTECTED] Regards, Richard Broersma Jr. ---

Re: [SQL] sql problem with join

2006-11-15 Thread Richard Broersma Jr
and then make up some results that you would really like to get. I am not entirely clear what you are trying to achieve. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

Re: [SQL] select into

2006-11-22 Thread Richard Broersma Jr
eractive/sql-selectinto.html and particularly this example: http://www.postgresql.org/docs/8.2/interactive/sql-selectinto.html#AEN54014 Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] select into

2006-11-22 Thread Richard Broersma Jr
yet when it comes PL/pgsql. Thanks for the clarification. Regards, Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 3: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [SQL] SQL command join question

2006-11-29 Thread Richard Broersma Jr
can refer to any of it's enternal tables any more. So (t1.c=...) should really be (t.c=...). this is what I expect would work: select * from t1 left outer join t2 on ((t1.a,t1.b) = (t2.a,t2.b)) left outer join t3 on (t1.c = t3.c) ; Regards,

Re: [SQL] Setting boolean column based on cumulative integer value

2006-12-01 Thread Richard Broersma Jr
ger record because he/she wishes to get off early you will need to have an additional update statement to shift down higher valued records insure that the range does not have any gaps. Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

Re: [SQL] Using Control Flow Functions in a SELECT Statement

2006-12-04 Thread Richard Broersma Jr
not believe that the "IF" predicate exists. However the "CASE" predicate does and will do what you want. http://www.postgresql.org/files/documentation/books/aw_pgsql/node44.html Regards, Richard Broersma Jr. ---(end of broadcast)--

Re: [SQL] Using Control Flow Functions in a SELECT Statement

2006-12-04 Thread Richard Broersma Jr
> Thanks FOR your prompt responseBut USING CASE issue still NOT resolved > Oracle prompts same error. I see, was answers to you get from the oracle mailing lists regarding this problem? ;o) Regards, Richard Broersma Jr. ---(end of bro

Re: [SQL] Can someone explain the problem with this select

2006-12-05 Thread Richard Broersma Jr
anything else with it. select * from ( select doc_num from documents limit 10 ) as D1 left outer join comments on (D1.doc_num = comments.doc_num) ; Regards, Richard Broersma Jr. ---(end of broadcast)

Re: [SQL] I don't want receive more emails

2006-12-05 Thread Richard Broersma Jr
> hi, could you tell me, what have I do for not reveice more emails Send an email to: [EMAIL PROTECTED] Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating

Re: [SQL] Need to subtract values between previous and current row

2006-12-15 Thread Richard Broersma Jr
> row3 and so on... just an idea. select (A.atime - max(B.atime)) duration from table A join table B on (A.atime > B.atime) group by A.atime; Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 4: Have you searched our

  1   2   >