RE: [SQL] Simple SQL-syntax

2001-08-20 Thread Robby Slaughter
atement. And second, you need to be careful to make sure all your tokens make sense. You had an extra "B" in the middle of your statement. Based on this: UPDATE tableA,tableB SET tableA.NrA = tableB.NrB WHERE tableA.NrA = tableB.NrB should achieve the desire

RE: [SQL] Sequential select queries...??

2001-08-20 Thread Robby Slaughter
id FROM T WHERE name = 'abc' UNION SELECT id FROM T WHERE desc = 'abc'; You'll get: id 1 2 That ought to do it for you! Hope this helps, Robby Slaughter ---(end of broadcast)--- TIP 2: you can get off all

RE: [SQL] Delete Trigger Issue

2001-08-06 Thread Robby Slaughter
lly VARCHAR fields. Hope that helps! -Robby Slaughter -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Sundararajan Sent: Tuesday, August 07, 2001 12:16 AM To: [EMAIL PROTECTED] Subject: [SQL] Delete Trigger Issue I am developing a db application in postg

RE: [SQL] Delete coloumn

2001-08-06 Thread Robby Slaughter
,data INTO sample_copy FROM sample; and then you can DROP TABLE sample; If you need the original table name, repeat the process of creating a new table now and copying the data over. Hope that helps! -Robby Slaughter -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTE

RE: [SQL] Simple Insert Problem

2001-08-06 Thread Robby Slaughter
Gonzo: You need to make sure that you delimit your values correctly. To insert text fields (which may contain spaces) use 'single quotes'. You'll also want to enter date fields the same way. So, you should try INSERT INTO OP (op_num,op_name,start_time) VALUES (5400,'Welding','06:00:00'); Of c

RE: [SQL] Fuzzy matching?

2001-07-31 Thread Robby Slaughter
Here's an off the cuff reply: It sounds like fuzzy_match(str1,str2,num) is really just a tokenizer-type operation. The number is exactly one less than the potential number of string segments that you are interested in. For example: fuzzy_match('Thornton','Tornton',1) = TRUE Because the two

RE: [SQL] PL/PGSQL and external (flat ASCII) files - Urgent ... :)

2001-07-17 Thread Robby Slaughter
The hack and slash Perl programmer in me says--- if you only plan to do this once, (like importing data), then just write a Perl script that *generates* SQL code that does your inserts, updates, or whatever. You can then execute thsi with psql -f filename. But if you're trying to use flat files pr

RE: [SQL] First steps in plpgsql - language not recognized?

2001-07-17 Thread Robby Slaughter
Chris, sounds like you haven't called 'createlang plpgsql database-name' at the comand prompt. Try executing this and see if it works. -Robby -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Chris Ruprecht Sent: Tuesday, July 17, 2001 8:49 AM To: p-sql S

RE: [SQL] Unknown values in int8 fields?

2001-07-15 Thread Robby Slaughter
I've not been following this too closely but it sounds like you are trying to COPY records from table A to table B, where the table B also includes a serial value. Here's an easy trick which I'm pretty sure will work: instead of using COPY use SELECT INTO. It's much slower but I think it will do

RE: [SQL] Hey! ORDER BY in VIEWS?

2001-07-15 Thread Robby Slaughter
Josh: You wondered: >What happens if I put an ORDER BY in a view, then call an ORDER BY in a >query, e.g.: > >CREATE VIEW test_view AS >SELECT client_name, city, zip FROM clients >WHERE zip IS NOT NULL >ORDER BY zip; > >SELECT * FROM test_view ORDER BY city; > >Does the second ORDER BY override

RE: [SQL] Hey! ORDER BY in VIEWS?

2001-07-15 Thread Robby Slaughter
I think PostgreSQL allows you to do an ORDER BY in a view, but the real message is that it just doesn't make any sense. Remember that a view is just a "virtual table", not a query. If you "order by" as part of it's definition, there's no guarantee that the data will be orded when you SELECT FROM l

RE: [SQL] SQL question

2001-07-10 Thread Robby Slaughter
Deepali, Bruce Momjian's book on SQL provides a great intro to SQL, including joins. http://www.ca.postgresql.org/docs/aw_pgsql_book/ If you have a specific question, please post that to a list Good luck! -Robby -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On

RE: [SQL] "Display of specified number of records."

2001-07-10 Thread Robby Slaughter
You want to just display records WHERE the field is BETWEEN 10 and 50? SELECT * FROM test WHERE testID BETWEEN 10 AND 50; If you want them to be ordered by the testID, just include a ORDER BY testID; See, isn't SQL a friendly language? :-) -Robby Hi, I have got following simple SQL. Selec

[SQL] pl/pgSQL and escaping LIKE clauses

2001-06-25 Thread Robby Slaughter
I'm having trouble getting LIKE clauses to work correctly inside a plpgSQL function. Here's my table: id | val +- 1 | hello 2 | there 3 | everyone Here's my function: CREATE FUNCTION intable(char) RETURNS INTEGER AS ' DECLARE input ALIAS FOR $1; temp INTEGER; B

RE: [SQL] large going giving errors.

2001-06-13 Thread Robby Slaughter
What happens when you don't join quite so much? That is, take off the AND blah blocks, one by one? -Robby -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, June 13, 2001 3:38 PM To: [EMAIL PROTECTED] Subject: [SQL] large g