[GENERAL] Help Join Tables
Hey, I'm having some trouble trying to join tables because I'm trying to join data in a column to a column name. An example looks like this: Table 1: field_names(varchar 255) | field_title(varchar 255) name_field | User Name interest_field | User Interest number_field | User Number Table 2: user_id | name_field | interest_field | number_field 1 | John | Baseball | 555- For the beginning of a sql query I have SELECT table2.name_field, table2.interest_field, table2.number_field, table1.field_title JOIN table1 ON ?? WHERE table2.userid=1 So basically I am trying to match up the column name with the field. Can anyone help me with this? Thank -- View this message in context: http://old.nabble.com/Help-Join-Tables-tp27507462p27507462.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
[GENERAL] Help on constructing a query that matches array
Hey all, I need help on constructing a query with arrays that matches the arrays up as foriegn keys to another table. For example, say that I have two tables, owners and pets. Owner Table owner_id | pet_ids 1 |{1,2,3} 2 |{2,3} Pet Table pet_ids | Pet Type 1| Dog 2| Cat 3| Fish 4| Bird Basically I am trying to create a SELECT query that returns the type of pets an owner has by matching the pet_ids up. Can anyone help me with this? -- View this message in context: http://old.nabble.com/Help-on-constructing-a-query-that-matches-array-tp27234475p27234475.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
[GENERAL] Order By Date Question
I have a question about ordering by date. I have a table with two fields and some date Name(character varying) | Event_Date(timestamp with timezone) A |2009-09-10 5:30:00 B |2009-09-10- 00:00:00 C |2009-09-11 17:30:00 D | 2009-09-11 07:30:00 I want to order by date and then by name, so I want the result A,B,C,D. The problem is when I do a 'SELECT * FROM table_name ORDER BY Event_Date, DESC', it includes the actual time (HH:MM:SS) so the order comes out B,A,D,C. So what I am asking is how do I order only by the date? -MM-DD? -- View this message in context: http://www.nabble.com/Order-By-Date-Question-tp25346259p25346259.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
[GENERAL] Import Using PHPPGADMIN
Is there a plug-in or anything that will allow me to import a whole databases using PHPPGADMIN. I can import tables seperately but I have about some 70 odd tables to import. -- View this message in context: http://www.nabble.com/Import-Using-PHPPGADMIN-tp25228684p25228684.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
[GENERAL] Select data for current week only
Hey all, I've been trying to figure this problem out with just using sql but I'm not sure how too. I have a table that holds events for each week but I only want to select events happening for the current week(Mon-Sun). So can anyone help me out with this just using sql? I've accomplished it sorta using php but only within the current 7 day range(example Thursday-Thursday) but not by the week. The field I am using for sorting is a Date type with the format -mm-dd hh:mm:ss . -- View this message in context: http://www.nabble.com/Select-data-for-current-week-only-tp25177178p25177178.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
Re: [GENERAL] Inserting Values into Interval
Tom Lane-2 wrote: BlackMage dsd7...@uncw.edu writes: I am having a small issue when entering values into the interval field. Say I want to enter a time of 2:03, two minutes and 3 seconds. When I insert that into an interval field, it comes up at 02:03:00, 2 hours, 3 minutes. The only way I've gotten around this so far is by doing 00:02:03. But I was wondering if there is another of inserting into an interval field where the values will start at the lower end first, so the result will be 00:02:03 when 2:03 is inserted? In 8.4 it'll be possible to do that by declaring the interval as MINUTE TO SECOND, but there's no way around it in existing releases. I'm not sure I'd care to rely on that anyway, because any time you provide an interval value that isn't *immediately* tied to a MINUTE TO SECOND qualifier, it's going to get interpreted in the more standard way. I think you'd be happier in the long run if you avoid depending on such an ambiguous data format. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general Well what format should be used then? The application works like this. Users use a watch time how fast they run from point A to point B. Afterwards they enter the time taken, say 5 minutes 39 seconds, into a field. The field already checks to make sure the time is entered in the correct format. After that it takes the time entered in that fields an enters it into a the db. So what other field would you enter this into in the db? -- View this message in context: http://www.nabble.com/Inserting-Values-into-Interval-tp24153731p24164840.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
[GENERAL] Inserting Values into Interval
Hey, I am having a small issue when entering values into the interval field. Say I want to enter a time of 2:03, two minutes and 3 seconds. When I insert that into an interval field, it comes up at 02:03:00, 2 hours, 3 minutes. The only way I've gotten around this so far is by doing 00:02:03. But I was wondering if there is another of inserting into an interval field where the values will start at the lower end first, so the result will be 00:02:03 when 2:03 is inserted? This will make developing application so much easier if there is, so thanks. -- View this message in context: http://www.nabble.com/Inserting-Values-into-Interval-tp24153731p24153731.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general
[GENERAL] Entering time into postgresql
Is there a field that can actually store time in PostgreSql. And what I mean by time is not like time of the day, but a specific amount of time. The application I am developing records how long it takes for a user to do a task, say 5 minutes and 32 seconds. That time is entered into the database so latter it can be sorta like: SELECT * FROM user_time WHERE time_taken6:00. Thanks in advance. -- View this message in context: http://www.nabble.com/Entering-time-into-postgresql-tp23925803p23925803.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general