Re: [SQL] DISTINCT ON troubles

2004-02-19 Thread Jeremy Smith
Thanks Josh, I'll do that, I just wasn't sure if I was missing something obvious. Jeremy -Original Message- From: Josh Berkus [mailto:[EMAIL PROTECTED] Sent: Thursday, February 19, 2004 2:29 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [SQL] DISTINCT ON troubles Jeremy, >

[SQL] DISTINCT ON troubles

2004-02-19 Thread Jeremy Smith
Hi, I have a query that reads: SELECT DISTINCT ON (messageboard.threadid) messageboard.threadid, messageboard.topic, owner.ownerid, owner.username FROM messageboard, owner WHERE messageboard.ownerid=owner.ownerid AND messageboard.leagueid = '$leagueid' ORDER BY messageboard.messageid DESC LIMIT $

Re: [SQL] Inserting NULL into Integer column

2004-02-18 Thread Jeremy Smith
I've run into this kind of thing before. IT helps if you have an array of all your fields like: $fields = array("field1","field3","last_name"); and then you can foreach across the input: foreach($fields as $f){ if (!$_POST[$f]){ $_POST[$f]='DEFAULT'; } else { $_POST[$f] = "'".$_PO

Re: [SQL] Inserting NULL into Integer column

2004-02-18 Thread Jeremy Smith
-- From: scott.marlowe [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 18, 2004 2:44 PM To: Jeremy Smith Cc: [EMAIL PROTECTED] Subject: Re: [SQL] Inserting NULL into Integer column On Wed, 18 Feb 2004, Jeremy Smith wrote: > Hi, > > in mysql I was able to make an insert such as: > &g

[SQL] Inserting NULL into Integer column

2004-02-18 Thread Jeremy Smith
Hi, in mysql I was able to make an insert such as: INSERT INTO TABLE (integervariable) VALUES ('') and have it either insert that variable, or insert the default if it had been assigned. In postgresql it gives and error every time that this is attempted. Since I have so many queries that do th

Re: [SQL] CHAR(n) always trims trailing spaces in 7.4

2004-02-18 Thread Jeremy Smith
Also, to make char(n) even more annoying, I had the one character value "K" stored in a column that was char(2). When I pulled it from the database and tried to compare it to a variable with a value of "K" it came out inequal. Of course in mysql, that was not a problem. Jeremy -Original Mess

Re: [SQL] bytea or blobs?

2004-02-17 Thread Jeremy Smith
On this subject, isn't it actually better to just store image names in the database and pull the image itself from a directory? That's what I do on my site because I didn't want to bloat up my database unnecessarily. Are there additional benefits to storing the image information in the database