Re: Conditional copy of values

2006-09-25 Thread Michael Stassen
Ravi Kumar. wrote: Dear All, I have 2 tables Table1 and Table2. In Table1 rowid is primary key and in Table2 rowid is primary key as well as foreign key (referring to rowid in Table1). There are several other columns in Table1, but Table2 has only one col - rowid. I want to insert rowid i

Re: Mysql pushing data to client

2006-09-25 Thread Michael Stassen
David Godsey wrote: > I am looking for a way to write a client program that will wake up when > there is new data in the database, much like replication. > > So instead of my client pulling the database on some fixed interval, I > would like the mysql daemon to push the data to my client when ther

Re: subquery performance

2006-09-25 Thread Michael Stassen
Jeff Drew wrote: > I have a query with a subquery which does not throw an error, but does not > return either. I've been testing the query using mysql Query Browser and > the poor dolphin jumps only once a minute or so ;) I use MYSQL's > excellent error documentation heavily so if the query do

Re: Why can't I delete these records?

2006-08-27 Thread Michael Stassen
Evert wrote: > Hi all! > > Who can tell me why the following does not work...? > > When I do: > SELECT COUNT(*) AS counter FROM table1 WHERE condition1 = 'A' AND > condition2 IS NULL; > > it returns: > +-+ > | counter | > +-+ > | 2 | > +-+ > > Then I do: > DELETE FROM

Re: displaying a sing thumbnail

2006-08-26 Thread Michael Stassen
[EMAIL PROTECTED] wrote: I have a database of images, http://www.thethistlehouse.com/db.jpg What I want to do is select ONLY ONE image to display as a the image link for that gallery. As you can see galleries are numbered dynamcially but galleries can also be added and deleted so the galleries

Re: AW: AW: find in list

2006-08-17 Thread Michael Stassen
Charlie Schaubmair wrote: Hello Michael, thx, I know normalisation. BUT normalisation isn't always the best (fastest) way to store, or select the datas, this is why I don't use it most time. Often I'm testing my projects with normalisation and without and my last very big problem with big selec

Re: 1 to many relationship

2006-08-17 Thread Michael Stassen
Chris wrote: > Hmm. Must be a recent change, I've had problems with that in the past. > > Thanks for the pointers. You're welcome. I'm not sure which part you think is a recent change. Certainly, mysql 5 with its demotion of the precedence of the implicit join is recent. Perhaps it depends o

Re: 1 to many relationship

2006-08-17 Thread Michael Stassen
Peter Lauri wrote: > Is there not a better way to do that? What will happen there is that a large > result set will be created because when you just do "select * from > customers c, issues i, customer_issues ci" it will be like the inner product > from all these tables, and then just choosing the

Re: 1 to many relationship

2006-08-17 Thread Michael Stassen
Chris wrote: > select * > from customers c, issues i, customer_issues ci > where c.customerid=ci.customerid > AND ci.issueid=i.issueid; Chris wrote: > That query should be the same as this one: > select * > from customers c > inner join customer_issues ci on (c.customerid=ci.customerid) > inne

Re: Trouble with using "IN" for a sub-query statement

2006-08-17 Thread Michael Stassen
Chris wrote: Chris White wrote: On Monday 07 August 2006 12:13 pm, William DeMasi wrote: I meant to have it say : "select * from c2iedm_dev2.act where act_id IN (select obj_act_id from c2iedm_dev2.act_functl_assoc where subj_act_id =24);" What does the output of (the subselect): select obj_

Re: AW: find in list

2006-08-16 Thread Michael Stassen
Charlie Schaubmair wrote: > Hello, > > I want to do a query where I only gt the results by a numeric value: > > select * from MyTable where 1 IN someFieldInMyTable > I know this query doesn't work, but maybe anyone knows what I mean. > > 1 can be a value betwenn 1 and 23 > someFieldInMyTable is n

Re: query needed

2006-08-16 Thread Michael Stassen
VenuGopal Papasani wrote: > Once again i send the table data: > > Code Period Value > c12004 22 > c12005 10 > c22005 15 > c32005 20 > c42005 15 > c52005 5 > c62005 30 >

Re: Query Question

2006-08-14 Thread Michael Stassen
The story so far, with comments: Michael DePhillips wrote: > Hi, > > Does anyone have a clever way of returning; a requested value with one > value less than that value, and one value greater than that value with > one query. > > For example T1 contains > > ID > 1234 > 1235 > 1236 > 1238 > > sel

Re: Get a Numeric Zero instead of NULL in SELECT

2006-08-14 Thread Michael Stassen
Asif Lodhi wrote: Hi, I have a query: INSERT INTO tmp2 (x) SELECT ((t3.m * 100) + b.id) AS x2 FROM tmp3 t3 LEFT JOIN (SELECT (MAX(x) - ((MAX(x) div 100) * 100)) + 1 AS pid FROM tmp2 WHERE (x div 100) = 2147 HAVING (MAX(x) - ((MAX(x) div 1

Re: IN or OR? whats the diff?

2006-07-31 Thread Michael Stassen
Ratheesh K J wrote: Hello all, Just wanted to know if using IN in the where clause is better than OR in terms of performance. that is : Are these both same in terms of performance SELECT * FROM TABLE WHERE ( COLUMN = 1 OR COLUMN = 2 ); SELECT * FROM TABLE WHERE COLUMN IN ( 1, 2 );

Re: select random ids from list

2006-07-31 Thread Michael Stassen
kalin mintchev wrote: select id,title from content where id IN(10,20,30); cool thanks.. what if i want it to be random ordering like: select id,title from content where id IN(20,10,30); and i would like the order of the ids and the in() to be kept in the result array. what 'order by' would i

Re: Problems with WHERE clause

2006-07-30 Thread Michael Stassen
Jørn Dahl-Stamnes wrote: > I got the following query: > > select s.id,s.name,sum(p.fee) as fee from serie as s inner join race_serie as > rs on (rs.serie_id=s.id) inner join races as r on (r.id=rs.race_id) inner > join participants as p on (p.race_id=r.id) where s.receipt=1 and > p.rider_id=236 an

Re: WHERE problem, or is it a problem?

2006-07-26 Thread Michael Stassen
Peter Lauri wrote: Best group member, I have this query on MySQL version 4.0.27: SELECT part.memberid, part.prefname, part.email, COUNT(*) AS numberofans FROM tblparticipants part LEFT JOIN tblanswers answer ON (answer.par_num=part.memberid) LEFT OUTER JOIN profilepdfauth pdfauth ON (part.membe

Re: Granting all to a user with a db name prefix

2006-07-24 Thread Michael Stassen
Paco Zarabozo A. wrote: Hello All, I'm trying to GRANT ALL to a user only on DBs that math a prefix, but i can't find the way to so it on the documentation. Let's assume the username is "john". I want him to have all privileges only on databases with the prefix john, so he can: - create and

Re: Temporary table ERROR 1109 (42S02) where are temporary tables kept?

2006-07-05 Thread Michael Stassen
Jacob, Raymond A Jr wrote: Thank you, I was definitely on the wrong track on this one. I annotated your commands to make sure that I understood what they were doing. Are my comments correct? --- You have the wrong syntax. You can't mention a table in the WHERE clause that wasn't in t

Re: Temporary table ERROR 1109 (42S02) where are temporary tables kept?

2006-07-05 Thread Michael Stassen
Jacob, Raymond A Jr wrote: I ran the following commands: USE snort; CREATE TEMPORARY TABLE sidtemp SELECT cid FROM event WHERE timestamp < '2006-05-01'; ... SELECT count(*) from sidtemp; count(*) 7501376 DELETE FROM data WHERE data.cid = sidtemp.cid; ERROR 1109 (42S02): Unkown table 'sidtem

Re: mysqldump: Got errno 27 on write. file too large

2006-07-05 Thread Michael Stassen
Dominik Klein wrote: > This might be a filesystem problem. Some filesystems (in certain > configurations) cannot hold files larger than a particular size. > > Do you have any files larger than that cut dumpfile on that partition? > Duhaime Johanne wrote: > Thank you for your answer. > > Yes I hav

Re: Records in front of and behind another record

2006-06-26 Thread Michael Stassen
Scott Haneda wrote: > Mysql 4 > > I have a frustrating case here, a list of numbers, say, 0 through 30,000 or > so, however, there are gaps in the numbers, so not purely sequential. > > I am faced with selecting one record from the dataset, that's simple, > however, before that select, I need to m

Re: if else statement

2006-06-22 Thread Michael Stassen
Song Ken Vern-E11804 wrote: > Hi, > > I'm trying to build a query in using SQL instead of doing it in Perl. > > I am trying to do something like this : > > If ((select col1 from table1 where id = 1) == 3) > Then > Select col2 from table2 where table2.id = 1; > Else > Select col2 from table3 where

Re: ERROR 1016 (HY000): Can't open file: 'agent.ibd' (errno: 1)

2006-06-14 Thread Michael Stassen
murthy gandikota wrote: > Here are some pertinent facts: > a) stopped mysqld > b) copied files from sfg to sfgnew in the var directory > c) set the permissions to 777 (read, write, execute) for all the files in sfgnew > d) restarted mysqld Dan Buettner wrote: > Murthy, do you have

Re: Differences between MySQL 4 and 5 for scripts

2006-06-14 Thread Michael Stassen
Graham Reeds wrote: I have posted a similar question on the blojsom group but I feel I will have better chance of an answer here. Blojsom 3 was developed using MySQL5 for it's back end. However the host I am with uses 4.0.25 and are unwilling to upgrade - which is fair enough. So I decided

Re: Limiting results from joins

2006-06-12 Thread Michael Stassen
Kim Christensen wrote: > Hey list; > > Consider this statement: > > SELECT * FROM products p, manufactors m, items i WHERE p.manufactor_id > = m.manufactor_id && p.product_id = i.product_id; > > Now, each unique product_id from "products" can have more than one > entry in the "items" table, but I

Re: DateTime limits

2006-06-06 Thread Michael Stassen
Ben Clewett wrote: > C# has two DateTime constants: > > DateTime.MinValue = '0001-01-01 00:00:00.000' > DateTime.MaxValue = '-12-31 23:59:59.999' > > > MySQL really doesn't like these values, it shows warnings: > > +-+--+-+

Re: Help with query: Row number / Rank from a query...

2006-06-01 Thread Michael Stassen
Dan wrote: I have a regular query lets say: Better to show the real query, rather than a simplified version. Simplified requests get you simplified answers. What seems like a simplification to you, may in fact hide a crucial piece of information, thus preventing anyone from giving you a so

Re: Need help querying a database of polynomials

2006-06-01 Thread Michael Stassen
Lew E. Lefton wrote: > Hi, > > I hope this is an appropriate place to ask this question, if you think > it is better suited for another list/forum, please let me know. > > I have a table that looks like this: > > mysql> select polynomial_id, term_id from polynomial; > +---+-+

Re: Get the record with the latest date

2006-05-27 Thread Michael Stassen
Brian Menke wrote: Sorry about the last post, I hope this one comes over better. This is a bit embarrassing because I think this should be a simple WHERE clause, but it escapes me at the moment. I have a table with data: module_id emailscore date_time 1 [EMAIL PROTECTED] 8

Re: grant modify, doc on grant.

2006-05-27 Thread Michael Stassen
Dilipkumar wrote: Dude listen, You can given file privileges to existing users for all the Db's as if you specify as grant file on database.* to [EMAIL PROTECTED] identified by 'passwd'; [ *Error* ] If you mention to all the DB for a user as: grant file on *.* to [EMAIL PROTECTED] identifie

Re: grant modify, doc on grant.

2006-05-27 Thread Michael Stassen
Gilles MISSONNIER wrote: > Hello > How to set "FILE privilege enable" to an already defined user ? > > It seems that I have to read the all manual for that. > I cannot find an example in the on line manual. sheeri kritzer wrote: > GRANT FILE ON dr4.* to 'wr'@'localhost' IDENTIFIED BY 'the_passw

Re: Adding row numbers to a select.

2006-05-19 Thread Michael Stassen
Chris W wrote: Is there an easy way to add row numbers to the result of a select statement? With a user variable: SET @i = 0; SELECT @i:= @i + 1 AS 'Row', ... Michael -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/

Re: Baffled by query error syntax

2006-05-18 Thread Michael Stassen
sheeri kritzer wrote: MySQL usually gives a syntax error *where* the error happens. In this case, it would indicate a problem with "SEC_TO_TIME(" but there shouldn't be a problem, both according to the manual AND according to my example. The parser reads the query left-to-right and always qu

Re: Baffled by query error syntax

2006-05-18 Thread Michael Stassen
Mike Blezien wrote: Hello, this is a continued problem we are having from a earlier posting to the list regarding a query. We need to calculate the SUM of the column 'agent_product_time' which is a TIME datatype column and according to the manual: http://dev.mysql.com/doc/refman/4.1/en/date-

Re: How to convert this DELETE command from MySQL 4.0.25 to 3.23?

2006-05-06 Thread Michael Stassen
The Nice Spider wrote: > Hi, > > This query running fine on 4.0.25 but when trying on > 3.23 an error occurs. > can one help me to find correct command for 3.23? > > DELETE FROM A > USING A > RIGHT JOIN B ON B.id = A.sectionid > WHERE B.id is null > > This task is deleted any row in A that have no

Re: describe table : improvement

2006-04-21 Thread Michael Stassen
[EMAIL PROTECTED] wrote: Thankyou Gabriel. So how does one set a column comment then? Regards Keith As part of the column definition, as documented in the manual . column_definition: col_name type [NOT NULL | NULL] [DEFAULT d

Re: MySQL 4.1.18-64 bit won't start after JS2E update on OS X

2006-04-21 Thread Michael Stassen
Geoffrey Sneddon wrote: On 21 Apr 2006, at 17:18, Geoffrey Sneddon wrote: After the JS2E 5.0 Release 4 update on Mac OS 10.4.6 on the 19th, MySQL 4.1.18 64-bit hasn't started. It begins to start up, before ending with "ERROR!". Any possible reasons/solutions? Did you check mysql's error lo

Re: bug in simple select, what is going on?

2006-04-21 Thread Michael Stassen
kmh496 wrote: hi, i am running a join query between the german_english table and the user_todo_german_english tables, to figure out which words a user is studying. the key i am using is a combination of wordid + pos + posn (that is part of speech == pos) however, i am not able to correctly do the

Re: How to Find Most Recent Autoincrement Index Assigned???

2006-04-21 Thread Michael Stassen
David T. Ashley wrote: I'm using PHP, and I sometimes INSERT new records in a table. MySQL assigns a new autoincrement int field on each INSERT ... nothing surprising there. It goes 1, 2, 3, etc. What query can I use to find out what value this int autoincrement assigned field was? I could of

Re: WHERE doesn't work

2006-04-21 Thread Michael Stassen
Tom Lobato wrote: From: "Nicolas Verhaeghe" <[EMAIL PROTECTED]> Echo the UPDATE query itself and then copy/paste it here that way we'll see what is wrong. I already tried it. See some msgs before this. No sucess. When I paste the exactily same command to the mysql client, all works fine

Re: Reply / Return Address of this List

2006-04-18 Thread Michael Stassen
[EMAIL PROTECTED] wrote: The battle has been fought before - and the list administrator has given his reasons why he has not made the requested change. The way the list currently behaves is not an accident or omission, but a deliberate decision. I do not recall the grounds for that decision - m

Re: newbee error (1044)

2006-03-26 Thread Michael Stassen
Shawn Sharp wrote: Dilipkumar, Thanks much for the tipit did the job! Now we query mysql to see if the new mysql database is seen by mysql and it still only sees test: No, you can't see the mysql db, because you don't have permission to access it. I expect you are still logged in as the

Re: newbee error (1044)

2006-03-26 Thread Michael Stassen
Shawn Sharp wrote: I get the following error while trying to create the following database mysql mysql < zm_cre­ate.sql.in ERROR 1044 (42000): Access denied for user ''@'­loc­al­host' to database 'mysql' You are logged into mysql as the anonymous user, ''@'­loc­al­host'. By default, the anon

Re: deadlock - further information

2006-03-26 Thread Michael Stassen
Rithish Saralaya wrote: in 4.1.xx, you can use the my.cnf option innodb_locks_unsafe_for_binlog to make InnoDB to use a consistent read in the SELECT tables in CREATE ... SELECT. Read the caveats about the my.cnf option, though. Thanks. However, whatever is written in http://dev.mysql.com/do

Re: Client does not support authentication protocol requested by server

2006-03-26 Thread Michael Stassen
Andrew wrote: In the last episode (Mar 26), Andrew said: What could ever be the problem with the failing Perl DBI (C->B) connection, if everything is OK with a C->A connection (with and without Perl), and, in addition, a command-line C->B connection works? The password on B is a new-style pas

Re: Date Field Reverting to 0000-00-00 Format

2006-03-26 Thread Michael Stassen
Lola J. Lee Beno wrote: Here's an example of one of the tables where the date was retained successfully, with the string to the right of the decimal point being trimmed: 1Cobweb2005-01-13 15:21:50.654149 2Lace Weight2005-01-13 15:21:50.654149 3Sock2005-01-13 15:21:50.6

Re: getting started with mysql

2006-03-26 Thread Michael Stassen
Michael Friendly wrote: I've just started trying to use mysql (debian/linux 4.0.24_Debian-10sarge1-log), which I'm finding quite frustrating. I have a bunch of .csv files to try to import. They all have a first line containing field names. When I try load data ... I get errors no matter what I

Re: Find records not in many-to-many table?

2006-03-25 Thread Michael Stassen
barney wrote: Thanks, Stefan, But that only works if both tables have the same field name, doesn't it? If I use select FileKey from dl_files left join dl_merges using (FileID) where FileID is null MySQL returns Unknown column 'articles.dl_files.FileID' in 'on clause'. Correct me if I'm wrong,

Re: Date Field Reverting to 0000-00-00 Format

2006-03-25 Thread Michael Stassen
Lola J. Lee Beno wrote: I have a bunch of data where one of the columns is a date field. Here's a sample of the data that I have: 141415010001 02005-01-15 10:15:42.41837 281512010002 02005-01-15 10:22:37.756594 36

Re: Full outer join

2006-03-19 Thread Michael Stassen
Maurice van Peursem wrote: Hello, I like to have a full outer join. if you have the following tables: t1: id | val 1 | A 2 | B t2: id | val 1 | B 2 | C SELECT t1.id, t2.id, t1.val FROM t1 FULL OUTER JOIN t2 ON t1.val=t2.val ORDER BY t1.id,t2.id I want to get the following result (and

Re: problem with selecting my max bid ..

2006-03-17 Thread Michael Stassen
Gregory Machin wrote: Ok I tried the following SELECT dealer_id, auto_id, bid_amount FROM bids WHERE bid_amount=(SELECT MAX(bid_amount) FROM bids WHERE auto_dealer_id='3'); which gives +---+-++ | dealer_id | auto_id | bid_amount | +---+-++ |

Re: problem with selecting my max bid ..

2006-03-16 Thread Michael Stassen
Gregory Machin wrote: Hi. I have the following table | bid_id | dealer_id | auto_dealer_id | auto_id | bid_amount | timestamp | Bid_Status | +-+-+--++-++-+ | 1 |3 |

Re: Query Optimization Question

2006-03-14 Thread Michael Stassen
[EMAIL PROTECTED] wrote: Yes, a ranged query should respond faster than a negation. In some cases you can seriously improve query performance for a negation query if you split it into two range queries unioned together. Here is a pseudo example: This query should be slow due to the table scan

Re: Query Optimization Question

2006-03-13 Thread Michael Stassen
Robert DiFalco wrote: > In a previous database engine I was using an IN was more optimal than a > <>. So, for example: > > SELECT * FROM table WHERE table.type IN (1,2,3); > > Where the possible values of type are 0-3, was appreciably faster than: > > SELECT * FROM table WHERE table.type <

Re: update using 'set' keyword

2006-03-13 Thread Michael Stassen
fbsd_user wrote: Trying to bump the count_of_logons by 1 using this update. Phpmyadmin shows the count staying at zero. I think that this SET count_of_logons = 'count_of_logons + 1' is not coded correctly, but I get no errors so can not tell. Anybody have any ideas? The table def has coun

Re: Checking for good update

2006-03-13 Thread Michael Stassen
[EMAIL PROTECTED] wrote: On Sun, 12 Mar 2006, Michael Stassen wrote: [EMAIL PROTECTED] wrote: looks a bit strange to me. $result = mysql_query($query) or die('Query couldn\'t executed:'.mysql_error()); please try something like this: Why? There's nothing wrong with

Re: Checking for good update

2006-03-12 Thread Michael Stassen
[EMAIL PROTECTED] wrote: looks a bit strange to me. $result = mysql_query($query) or die('Query couldn\'t executed:'.mysql_error()); please try something like this: Why? There's nothing wrong with the above statement. // build the query - (that's OK) $query = "UPDATE members SET email_ve

Re: Checking for good update

2006-03-12 Thread Michael Stassen
fbsd_user wrote: > Using this code I get this error message. > > Warning: mysql_num_rows(): supplied argument is not a valid MySQL > result resource in /usr/local/www/data/mls_verifyemail.php on line 49 > > What code should I use to check if the update worked or not? Your second line does just th

Re: SQL Foreign Key

2006-03-12 Thread Michael Stassen
Andreas Krüger wrote: 1) Sorry for not giving you the version: Microsoft Windows XP [Version 5.1.2600] (C) Copyright 1985-2001 Microsoft Corp. *mysql> SELECT VERSION(); +---+ | VERSION() | +---+ | 5.0.17-nt | +---+* 1 row in set (0.00 sec) InnoDB Status after failing i

Re: Help on sql statement (not MySQL specifik)

2006-03-05 Thread Michael Stassen
Rhino wrote: I don't really understand _why_ you want to do this but here is a query that gives the result you want: select id, case type when 4 then 4 else null end as type from Soren01 group by id; The GROUP BY ensures that you get one row for each value of id; the case expression in the Se

Re: Help on sql statement (not MySQL specifik)

2006-03-05 Thread Michael Stassen
Søren Merser wrote: Hi, I'll try I need one record for each id in the tabel, i.e. NO duplicate id's with TYPE set to 4 or NULL Now, the TYPE of id 2 is 4 so I peserve it; As id 2 has more than one entry I have to delete it/them Id's with TYPE = NULL (id 1,4,5)is kept Id 5 (and 6) has two rec

Re: getting COUNT() TO return 0 for null matches in a query, how?

2006-02-26 Thread Michael Stassen
Ferindo Middleton Jr wrote: I have the following query which counts the records from a table called registration that have an schedule_id that matches a record in another table called schedules. The below query works fine but how can I get it to return a COUNT() of 0 each instance where there

Re: Timestamp error

2006-02-12 Thread Michael Stassen
pedro mpa wrote: Greetings! I am building a website using MySQL 5.0.18 and PHP 5.1.2. When I try to insert in a table a timestamp value from php's mktime() I get the following error: 1292: Incorrect datetime value: '1139776424' for column 'access_date' at row 1 The sql for the table is: CREATE

Re: Returning values from an INSERT

2006-02-11 Thread Michael Stassen
bob pilly wrote: Hi everyone, im new to SQL and have a question that someone can hopefully answer If i am inserting a new record into a table that has an auto_increment field in it, is it possible to get the value of that field returned automatically instead of having to do a SELECT..

Re: How to select data if not in both tables?

2006-02-11 Thread Michael Stassen
Bob Gailer wrote: Peter Brawley wrote: Grant, >If I want to select all the products that are in the product_table, >but not in the sale_table, how to make the query? The product_table >has all the products, but the sale table is a subset of the product_table. SELECT * FROM product_table

Re: Column in field list is ambiguous

2006-02-08 Thread Michael Stassen
Grant Giddens wrote: > Hi, > > I'm using mysql 4.1.14 and and getting this error: > > Column 'asin' in field list is ambiguous > > This is the query that is giving me the error: > > SELECT pn_pricecompare_searchdata.prod_id, > MATCH (asin,upc,...) AGAINST ('warcraft' IN BOOLEAN MODE) AS

Re: Can't Create Foreign Key Constraints

2006-02-07 Thread Michael Stassen
Lola J. Lee Beno wrote: I'm trying to create foreign key constraints and keep getting an error message 1005 (I did look it up, but didn't see an obvious solution to fixing this for my database). The version I'm using is 5.0.17-max. I used Mysql WorkBench to create the database schema and had

Re: MySQL says, "Ich don't think so" (Subquery woes)

2006-02-04 Thread Michael Stassen
René Fournier wrote: SELECT MAX(id) FROM history WHERE account_id = 216 GROUP BY asset_id ...works. Returns, e.g.: 1234, 3456, 5483, 8382. SELECT history.* FROM history WHERE history.id IN (1234, 3456, 5483, 8382 ) ...works too. But if I try to combine them using a subquery, a la... SELECT

Re: Creating REGEXP patterns with use of subquery

2006-02-03 Thread Michael Stassen
Kim Christensen wrote: Is there any way to build a REGEXP pattern set by using a subquery? I have a set of rows in table "table", with the column "value" being target for my query. That column's content is a bracket separated list of values, like this: [118][Word][Integer][Stuff]... [67][Anothe

Re: Help Understanding Document Syntax

2006-01-31 Thread Michael Stassen
Rhino wrote: First and foremost, thank you very much Michael for correcting my mistakes; I _was_ a bit sloppy in my reading of the syntax for the statements and that caused some unnecessary errors in my reply to Scott. However, your corrections are not _quite_ right even now. See below where

Re: Help on Unknown field error

2006-01-30 Thread Michael Stassen
pedro mpa wrote: Greetings. I need help on the following query. I get an error like "Unknown/Invalid column total_price [...]" when I try filter by total_price. How can I do this correctly? SELECT receipts.*, (SELECT SUM(receipt_itens.price) FROM receipt_itens WHERE receipt_itens.id_

Re: Help Understanding Document Syntax

2006-01-30 Thread Michael Stassen
Rhino wrote: The 'symbol' you are referring to, in the foreign key clause of the CREATE TABLE statement, is simply an opportunity for you to choose a name for the foreign key of the table; if you don't choose a name, MySQL will generate a default name for you. Therefore, if you do this:

Re: Sort before grouping

2006-01-30 Thread Michael Stassen
David Förster wrote: Hi, is there any way to get datasets sorted before they're grouped by GROUP BY()? I have a table of events at different locations and want to select the newest one for each location. However "SELECT * FROM events GROUP BY location ORDER BY date DESC" gives me just some eve

Re: How can I isolate the integer part of a varchar field and use it in an ORDER BY?

2006-01-24 Thread Michael Stassen
Nicolas Verhaeghe wrote: Because I am currently stuck with 3.23 I have just decided to create a "displacement" field to isolate the number. That's the right way to go, regardless of version. Besides, some of these bikes escape from the rules, for instance instead of 600 for 600cc, you only ha

Re: How can I isolate the integer part of a varchar field and use it in an ORDER BY?

2006-01-24 Thread Michael Stassen
Nicolas Verhaeghe wrote: Thanks, but unfortunately the replace function does not want to work on a regexp in version 3.23... or 4.0, or 4.1, or ... I guess I'll have to create a "displacement" field and populate it from the admin tool. Well, that's the right way to go. You're seeing the pr

Re: How can I isolate the integer part of a varchar field and use it in an ORDER BY?

2006-01-24 Thread Michael Stassen
George Law wrote: Nicolas, Not sure when the "replace" function was introduced into mysql, but I think it might do... REPLACE() exists in 3.23. Use "replace" in your order by, replacing a-z with null chars, leaving just your numeric digits, then order by Easier said than done. select *

Re: count(*) send a wrong value

2006-01-23 Thread Michael Stassen
fabsk wrote: > Hi, > > I'm facing a strange problem. I am using a database at my Internet > provider (Free, France). The type of table is MyISAM (no choice), MySQL > 4.1.15. I can do my tests with my PHP code or phpMyAdmin. > > The definition of my table is: > - uid, int > - cid, int > - response,

Re: Need help with a query

2006-01-23 Thread Michael Stassen
Mark Phillips wrote: I am running mysql 4.0.24 on Debian sarge. I have a table with two columns, "team" and "division", both varchar(255). There are some errors in the table where division has a value but team is blank. Given that I am getting new data, and the data entry folks may create a r

Re: Query Question

2006-01-16 Thread Michael Stassen
Douglas S. Davis wrote: Hi, If the following isn't appropriate, please feel free to ignore. The program I'm referring to is written in Perl and uses a MySQL database, so I thought perhaps it would be appropriate for this list. I have a webpage that displays a user's profile by selecting the

Re: Performance Problem on query kind of like a group by

2006-01-12 Thread Michael Stassen
Jim Tyrrell wrote: Everyone, I finally feel let down by mysql after 5 years of great use. I break most things in weeks so this is a heck of a record. I am sure I am being a dummy on this, but am wondering if there is some setting somewhere to help out a query like this. Given a table like thi

Re: Sorting with NULL

2006-01-09 Thread Michael Stassen
Marcus Bointon wrote: I have a table that contains a foreign key that can be null. When I do a search I want to have the matches that are null appear first, and then all other values sorted by another column. My data looks like this: idname nullabc 1def 2xyz nullzzz 7

Re: Help with a SELECT query

2006-01-06 Thread Michael Stassen
Jay Paulson (CE CEN) wrote: This helps a ton! Thanks! I didn' tknow about the INET_NTOA() or the INET_ATON() functions. That is much quicker to query on them than on a char set of ips. However, I did notice on the mysql web site that these functions are only available in 5.x but the way the page

Re: Getting # of days until expiration

2006-01-05 Thread Michael Stassen
Brian Dunning wrote: Thanks Peter, that appears to be exactly what I'm looking for, but it still gives an error and I've been through it with a fine-toothed comb, tried different versions, parens, etc. Here is the exact SQL statement I'm using, with your suggestion: select accounts.use

Re: SELECT help.

2006-01-05 Thread Michael Stassen
Richard Reina wrote: Can someone help me write a query to tell me the customer numbers (C_NO) of those who've had more than 4 transactions but none in the last 6 months? transactions_table | ID | C_NO |DATE | AMOUT | | 2901 | 387 | "2003-10-09" | 23.00 | Obviously my ta

Re: backslash and Update

2005-12-30 Thread Michael Stassen
Danny Stolle wrote: Hi, What you perhaps could use is the REGEXP usage in your where clause. Try this: update name set first_name=replace(first_name, '\\', '') where first_name regexp ''; The fun thing is that when you put '\\' instead of the '' after the regexp function it doesn't w

Re: Need Help Connecting

2005-12-22 Thread Michael Stassen
Mark Phillips wrote: David, This is what I got: [EMAIL PROTECTED]:~$ aliases bash: aliases: command not found Your shell is bash, so the correct command is `alias`. [EMAIL PROTECTED]:~$ which mysql /usr/bin/mysql Since you are using bash, it's a better idea to use `type` instead of `which

Re: User can see all databases...

2005-12-14 Thread Michael Stassen
William R. Dickson wrote: OK, I strongly suspect I've just done something stupid here, but I'm having trouble figuring it out. I had a disk go bad on a MySQL server this past weekend. I did a clean system install (FreeBSD 5.4) on a new disk, installed the MySQL 3.23 port, and restored the my

Re: bug in MySQL 5?

2005-12-13 Thread Michael Stassen
Octavian Rasnita wrote: From: "Gleb Paharenko" <[EMAIL PROTECTED]> Hello. In my opinion, it is not a bug. REPLACE has returned the sum of affected rows - one was deleted, and one was inserted. See: http://dev.mysql.com/doc/refman/5.1/en/replace.html Thank you. I have seen that's the true. I

Re: mysqladmin --skip-grant-tables error

2005-12-12 Thread Michael Stassen
Alfred Vahau wrote: According to the Mysql online manual, to reset a root password one procedure is to issue the command: ./mysqladmin --skip-grant-tables to have full access to the database and update the root password as per the instructions in the manual. My problem is when I issue the comm

Re: Select Unique?

2005-12-12 Thread Michael Stassen
Rhino wrote: - Original Message - From: "John Mistler" <[EMAIL PROTECTED]> To: Sent: Monday, December 12, 2005 12:34 AM Subject: Select Unique? I have two tables 'table1', 'table2' with a matching column 'column1'. How can I return all rows from table2 where the entry for table2.

Re: Select Unique?

2005-12-11 Thread Michael Stassen
John Mistler wrote: I have two tables 'table1', 'table2' with a matching column 'column1'. How can I return all rows from table2 where the entry for table2.column1 does not match any entries in table1.column1? SELECT * FROM table2 WHERE table2.column1 <> table1.column1 returns all the rows,

Re: SQL on Mac OS X - Socket Errors

2005-12-11 Thread Michael Stassen
Nathan Whitington wrote: Hello there, I've searched long and hard, and pestered many people for a solution and for help however I can not get around this problem. I have installed MySQL on my computer which is an Apple iBook G4 which is running Mac OS X 10.4.2 and I wish to use MySQL so th

Re: from MySQL to MS Excel ...

2005-12-11 Thread Michael Stassen
C.R.Vegelin wrote: Thanks JR, Shawn, Scott, ... for your replies. I choose to make use of the SELECT ... INTO OUTFILE. This works fine, but I also want a header-line in the CSV file. So I made the following statement: SELECT `ID`, `Code`, `Name` UNION SELECT `ID`, `Code`, `Name` INTO OUTFILE 'D:

Re: CAST as S=?ISO-8859-1?Q?IGNED,_bad_id=E9a??=

2005-12-09 Thread Michael Stassen
Test USER wrote: Hi again :) The table contains a column named value and is in the format varchar(255). This column contains specifications for different computer products. There is also a id column so i know which product it belongs to. value(varchar) 80 17" 1024x768 USB DiVX For example, the

Re: Normalization question

2005-12-09 Thread Michael Stassen
Rod Heyd wrote: Hi Everyone, I've got a little debate that maybe you can all help me settle. I have three tables that I need to join, but there are performance problems with the joins due to some misunderstandings of my predecessor about what's needed to join the tables efficiently. Here's the

Re: Alter MyISAM table to adjust max_rows and Avg_row_length

2005-12-08 Thread Michael Stassen
Jeff wrote: I've got a table that just hit the 4gig limit for MyISAM tables in a 4.x ver db. I need to alter the table structure and set the max_rows and Avg_row_length to override the default of 4 gig. Problem is I can't find any reference in the mysql docs that indicates how to decide a setti

Re: CocoaMySQL v0.7b2 Connection Help

2005-12-06 Thread Michael Stassen
[EMAIL PROTECTED] wrote: Responses intermixed. See below... untz <[EMAIL PROTECTED]> wrote on 12/02/2005 10:43:41 PM: 3. After logging into mysql, I created the following database: mysql> create database music_development to 'untz'@'localhost' identified by 'paintball'; MySQL databases

Re: Select questions

2005-12-05 Thread Michael Stassen
[EMAIL PROTECTED] wrote: Thank you for the table structures (I prefer the output from SHOW CREATE TABLE..) Now, would you mind also posting the actual query you used to produce what you are calling "duplicated" results? Thanks! Shawn Green Database Administrator Unimin Corporation - Spruc

  1   2   3   4   5   6   7   8   9   10   >