Re: Database equivalent to NorthWind for M$ SQL

2005-08-05 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Scott Hamm <[EMAIL PROTECTED]> writes: > Ok. Now that I got NorthWind into my MySQL 5.0.9 database and also am > running M$ SQL database server at where I work, this might be a good > opportunity for me to learn how to mirgate from M$ SQL database to MySQL > usin

Re: LATEST N RECORDS from a table without date field

2005-08-24 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Praveen KS" <[EMAIL PROTECTED]> writes: > Can anyone help with a query to retrieve latest N records. > No auto_increment field. > No date field. > Primary key exists and is populated with random unique values. This means that the only possible definition for "late

Re: Where to store comments?

2005-09-30 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Jonas Geiregat <[EMAIL PROTECTED]> writes: mysql> create table foo (id int NOT NULL comment 'test foo en bar'); This is a comment on a column which apparently gets displayed by SHOW CREATE TABLE only by later versions, e.g. 4.1.14. Table comments go after the clos

Re: ALTER TABLE - how to fix truncated data?

2005-10-19 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Martijn Tonies" <[EMAIL PROTECTED]> writes: mysql> insert into dt set a=999.1; >> Query OK, 1 row affected (0.00 sec) >> mysql> alter table dt change a a decimal(2,1); >> Query OK, 1 row affected, 1 warning (0.02 sec) >> Records: 1 Duplicates: 0 Warnings: 1 >>

Re: Checking Multiplicity Constraints and Retrieving Details from Error Messages

2005-10-20 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Jochem van Dieten <[EMAIL PROTECTED]> writes: > Back in reality you don't enforce this using DDL. Apart from the fact > that I wouldn't know a single database that implements ASSERTIONs > according to the SQL standard, can you imagine having to run some > SELECT fk

Re: Problem with load data and NULL

2005-11-05 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Barbara Deaton" <[EMAIL PROTECTED]> writes: > All, > I need help with using load data to load a text file that is created by > another application. > I have a text file that contains 2 columns, date and smallint and 2 rows: > d,e > 2005-12-31, > ,2 > In the abo

Re: Padding date results

2005-11-07 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes: > Both methods you describe are the commonly used techniques to solve your > particular problem. Every RDBMS system I have used responds in exactly the > same way to your query. > A) a database should not respond with data it does not h

Re: Problem with load data and NULL

2005-11-08 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Barbara Deaton" <[EMAIL PROTECTED]> writes: > Thank you for the idea. It fixed my date problem, but my numeric column is > still 0 and NOT "NULL." Here's what I did: > create table a ( > d date default null, > e smallint default null ); > CREATE TEMPO

Re: Query producing default values

2005-11-09 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Jacques Brignon <[EMAIL PROTECTED]> writes: > Thanks, that makes a lot of sense. > My only problem is that I am using here a standard piece of code on the > application side and I would hate to modify it, the thing I have all liberty > to > change is the query! Rea

Re: where is the mistake in this SQL statement?

2005-11-15 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Joerg Bruehe <[EMAIL PROTECTED]> writes: >> CREATE TABLE users ( >> id PRIMARY KEY, >> priority integer NOT NULL DEFAULT '7', >> policy_id integer unsigned NOT NULL DEFAULT '1', > Even though this may work, it is wrong IMNSHO: > You set character strings as defaul

Re: UNIQUE constraint, proper use

2005-11-22 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Ferindo Middleton Jr <[EMAIL PROTECTED]> writes: > I have this SQL statement: > CREATE TABLE rooms ( > idSERIAL, > room_name TEXT UNIQUE, > location TEXT, >

Re: Seeking Opinions

2005-11-29 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, sheeri kritzer <[EMAIL PROTECTED]> writes: > On 11/28/05, Martijn Tonies <[EMAIL PROTECTED]> wrote: >> >> > Part of me agrees with you, on a "Pure SQL level". but then why would >> > anyone ever use ENUM or SET? >> >> I wouldn't :-) >> >> IMO, they're abomination

Re: MySql 5 replacement for computed default column value

2006-01-03 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Daniel Kasak <[EMAIL PROTECTED]> writes: > Bryan Cantwell wrote: >> Trying to migrate to MySql 5 from Sybase asa. I have a tables that >> have column values that are calculated based on other columns in the >> table. How can I accomplish the same in MySql? >> > Thi

Re: Dump only data and Database

2006-01-24 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Paul DuBois <[EMAIL PROTECTED]> writes: > At 18:59 -0200 1/23/06, Luiz Rafael Culik Guimaraes wrote: >> Dear Friends >> >> What are the best options to dump an entire database on linux (with >> creation of databases and tables) with out dumping the index >> creatio

Re: How to Find the Max/Min from Multiple Columns (in each row)

2006-02-03 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Henry Chang <[EMAIL PROTECTED]> writes: > Hello everyone, > I have a table where measurement values are collected in mulitple columns. > Table Schema > == > ID, measurement_01, measurement_02, measurement_03 > ===

Re: arbitrary ORDER BY

2006-02-13 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Steve Lefevre <[EMAIL PROTECTED]> writes: > For posterity, this is how I solved the problem: > To create an abitrary for the ORDER BY clause, create a field like this: > SELECT > FIELD( field, > "arbitrary sort string 2", > "arbitrary sort string 3", > "arb

Re: stunningly slow query

2006-04-03 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes: >> Keith, >> Your method won't guarantee that there are no rows where the combination >> of the values in those four columns fails to repeat in any other row. To >> do that would require an EXTRA four-column unique index of type UNIQUE.

Re: Syntax for Compound "IF" Statements?

2005-02-08 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Johan Höök <[EMAIL PROTECTED]> writes: > Hi, > I guess your "CASE" statement should look something like: > CASE WHEN Location=1 THEN 'Downstairs Cat Room' > WHEN Location=2 THEN 'Kitten Room' > WHEN Location=3 THEN 'Quarantine' > ELSE 'Unknown' EN

Re: more complexity (was: select where multiple joined records match)

2005-02-14 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "AM Thomas" <[EMAIL PROTECTED]> writes: > Now, if I understand how this is working: > SELECT r.TITLE > FROM resources r JOIN goals g ON (r.ID=g.RESOURCE_ID) > WHERE g.SUBJECT = 'English' > AND (g.GRADE = 1 OR g.GRADE = 2) > GROUP BY r.ID > HAV

Re: one hour is/is not 60 minutes, that's the question...

2005-02-15 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, schlubediwup <[EMAIL PROTECTED]> writes: mysql> select addtime(now(), '00:00:00'); > ++ > | addtime(now(), '00:00:00') | > ++ > | 2005-02-15 16:49:17| > ++ > 1 row in set (0.

Re: help with an SQL query

2005-02-21 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "J S" <[EMAIL PROTECTED]> writes: > and I need to check the last date each user logged on to the proxy in > the last 3 months. > In my database, there is a table for the users: mysql> desc user_table; > +---+--+--+-+-+--

Re: UNIQUE Key Allowing Duplicate NULL Values

2005-02-23 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Gustafson, Tim" <[EMAIL PROTECTED]> writes: > Martijn, > The problem is that I don't want more than one row in the table that has > a null value in the column. As you've pointed out in your e-mail, > there's a difference between NULL and BLANK. It's not that I do

Re: SQL help

2005-02-28 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Rob Brooks" <[EMAIL PROTECTED]> writes: > The only difference in the 2 statements is the 'where items_online.ID = > NULL' part. > Clearly in the first set, items_online.ID = NULL in record 7047 ... Nope. items_online.ID IS NULL for that record, but comparing anyt

Re: Query Help

2005-03-01 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Jim McAtee" <[EMAIL PROTECTED]> writes: > In another table like this with month/year fields I once created a > dummy date field that I populated with the date of the first of the > month (1//), just to facilitate queries like this. Is > there another approach? Can

Re: DateTime Select optimised

2005-03-21 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Pete Moran" <[EMAIL PROTECTED]> writes: > Hi All, > Is there a simpler way of doing a select for a given date, for instance if I > have a datetime field called date > And so its populated with a load of values such as > 2005-01-07 09:00 > 2005-01-07 10:00 > 200

Re: subquery substitute in 4.0?

2005-04-04 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Gabriel B." <[EMAIL PROTECTED]> writes: > How can i do the following with 4.0? > delete fom t1 where id in (select id from t1 where usr_id = 10 order > by date_inserted limit 4,999) Put the result of the inner SELECT into a temporary table and then use the multi-

Re: Changed Number

2005-04-06 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes: > I have loaded a large *.csv spreadsheet into mysql and one number, the > grand total, changes from 16996941 on the Excel spreadsheet to 8388607 > in the mysql database. The numbers surrounding this number are > correct at all stages. I

Re: I need some help

2005-04-07 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, iNFERNo <[EMAIL PROTECTED]> writes: > Hi, > First of all thank you all for the quick replys. > Now here's: > select * from events limit 10; > +--+-- > --+++--+-+---+--+---+-- > > + > | id |

Re: Collecting the primary key using MAX during an insert

2005-04-20 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes: > Dan Rossi <[EMAIL PROTECTED]> wrote on 04/20/2005 12:55:45 AM: >> Hi there, I was wondering how its possible to get the MAX of a primary >> key of a table during an insert. I basically want to create a ticket >> number, but use the prim

Re: subquery fails when a NOT IN operator tests a subset with NULL valu

2005-03-16 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Giuseppe Maxia <[EMAIL PROTECTED]> writes: > The whole point is actually in subqueries, not when using IN or NOT IN in a > normal query. > The bug occurs when a NOT IN is used in a subquery as a LEFT JOIN replacement. > SELECT something from t1 where column1 NOT I

Re: setting character sets "permanently"

2005-04-24 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Fagyal Csongor <[EMAIL PROTECTED]> writes: mysql> show variables like 'character%'; >> +--+ >> -+ >> | Variable_name| Value >> | >> +--+--

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Jigal van Hemert" <[EMAIL PROTECTED]> writes: > From: "Martijn Tonies" >> Ehm... it might be me - but what sense does it make to have a NULL >> in a PK? >> If you "need" this, then your primary key probably isn't a primary key. >> >> Care to explain why and how yo

Re: why NOT NULL in PRIMARY key??

2005-04-26 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Jigal van Hemert" <[EMAIL PROTECTED]> writes: > From: "Harald Fuchs" >> > id INT(11) - accountID >> > name VARCHAR(32) - parameter name >> > value INT(11) - parameter value >> >> >

Re: Seeking advice on currency type

2005-04-29 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Hassan Schroeder <[EMAIL PROTECTED]> writes: > Scott Purcell wrote: >> I am seeking to create a table to hold prices for products. I am >> not sure what type would be best. According to the docs, I have many >> choices, dec, double, float, etc. Can anyone give me a

ONLY_FULL_GROUP_BY too strict on MySQL 4.1.11

2005-04-29 Thread Harald Fuchs
I'm using MySQL 4.1.11 with sql-mode=ONLY_FULL_GROUP_BY set in my.cnf. This disallows things like SELECT col1, col2, sum(col1) FROM tbl GROUP BY col1 as it should, and it allows SELECT col1, sum(col1) FROM tbl GROUP BY col1 but it also disallows SELECT col1, sum(col1) + 1 FROM

Re: Seeking advice on currency type

2005-04-30 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Hassan Schroeder <[EMAIL PROTECTED]> writes: > Paul DuBois wrote: >> Before MySQL 5, DECIMAL values are stored as strings, so operations >> are less efficient than for integers. >> In MySQL 5, the representation of DECIMAL has changed to binary >> format, >> so it'

Re: How to extract only the first few lines from a longtext field

2005-05-09 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, symbulos <[EMAIL PROTECTED]> writes: > On Monday 09 May 2005 15:17, Roger Baklund wrote: >> You could use the LEFT() function to return for instance the 200 first >> characters: >> >> SELECT LEFT(article,200) AS start_of_article >> FROM articletable WHERE ... >> >

Re: SELECT Row Numbers?

2005-05-10 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes: > hi, > your need is: > select * from temp LIMIT 3,4; > -- 3 because you have to take the fourth and 4 because dist=3+1 This does not make sense. A SELECT without an ORDER BY returns the rows in some undefined order. If you use "LIMIT 3,

Re: SELECT Row Numbers?

2005-05-10 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes: > Hi, > Have you forgotten what's a primary key ? > Using order by will sort data, and if it's already sorted, it will be sorted > again. Time, memory and maybe disk io. If MySQL really does that, I'd consider this a bug. > Using the mar

Re: SELECT Row Numbers?

2005-05-10 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes: >> CREATE TEMPORARY TABLE tbl1 ( >> id INT UNSIGNED NOT NULL, >> val INT UNSIGNED, >> PRIMARY KEY (id), >> UNIQUE KEY (val) >> ); >> >> INSERT INTO tbl1 (id, val) VALUES (1, 1); >> INSERT INTO tbl1 (id, val) VALUES (2, 2); >> INSERT INTO t

Re: possible join

2005-05-11 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Peter Brawley <[EMAIL PROTECTED]> writes: > Scott, sorry, my mistake, >   SELECT price >   FROM fedex_zones z >   INNER JOIN fedex_rates r ON z.zone=r.zone AND z.zip=94947 >   WHERE r.weight = 25; > PB Although correct, many people consider this bad style - the ON

Re: write query question

2005-05-11 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Eric Jensen <[EMAIL PROTECTED]> writes: > So you want 5 contacts for every user? Try this: > SELECT COUNT(c.id) AS count, u.username, u.first_name, u.last_name, > c.name > FROM user AS u, contact AS c > WHERE u.id = c.id_user > GROUP BY c.id_user > HAVING count

Re: Report(query)

2005-05-12 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Seena Blace <[EMAIL PROTECTED]> writes: > Hi, > I want report like this > date process pending wip > 5/10/051030 40 > 5/11/05 09 28 60 > ---

Re: Numbering rows

2005-05-13 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Mauricio Pellegrini <[EMAIL PROTECTED]> writes: > This is the table I have > Column Id is primary key and auto_numeric > - > Idorder itemvalue col_type > - > 1 3

Re: Numbering rows

2005-05-17 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Mauricio Pellegrini <[EMAIL PROTECTED]> writes: > Wow, that's simply magic!!! > You couldn't imagine how many diferent things I've tried > to solve this problem.. > And when I thought it was impossible ...your solution worked > just fine at once! > God bless expe

Re: Efficient select/insert

2005-05-19 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Eamon Daly" <[EMAIL PROTECTED]> writes: > my $sql = sprintf <<'EOF', join(',', @array); > SELECT col2, col3, col4 > FROM table1 > WHERE col1 IN (%s) > EOF > my $sth = $dbh->prepare($sql); > $sth->execute() or die $sth->errstr(); This code is susceptible for an SQ

Re: 2 Joins in 1 Query

2005-05-23 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "shaun thornburgh" <[EMAIL PROTECTED]> writes: > Hi, > Unfortunately that doesnt work, I need to LEFT JOIN Bookings to Weeks > but keep the current join on Projects there as well, any ideas? So what you would need is something like that: Weeks LEFT JOIN (Bookings

Re: LOAD DATA and skip columns in text file...

2005-05-25 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Jessica Svensson" <[EMAIL PROTECTED]> writes: > LOAD DATA and skip columns in text file... > What i have found out is that this is not possible in any existing > version of mysql, correct? > I found a message from Sinisa Milivojevic @ MySQL AB dated 06/29/2000 >

Re: LEFT JOIN changes order of results

2005-06-01 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Scott Gifford <[EMAIL PROTECTED]> writes: > The problem we're seeing is that when additional tables are pulled in > for the detailed view, the order is different from the summary view, > so the wrong homes are displayed. Here's a simplified example. A > summary qu

Re: Q: outer join w/restriction

2004-10-14 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Martin Gainty" <[EMAIL PROTECTED]> writes: > "You should generally not have any conditions in the ON part that are used to > restrict which rows you want in the result set, but rather specify these conditions > in the WHERE clause" > Forgive me for following the

Re: Date range with empty rows (Was: Intra-table join)

2004-10-14 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Partap Davis <[EMAIL PROTECTED]> writes: > I'm graphing the data from this query using dates on the x axis. The > input to my graph module (GD::Graph) requires a constant-length list. > So if any days in my selection range have no data, I need to fill the > space

Re: Query help

2004-10-17 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, John Mistler <[EMAIL PROTECTED]> writes: > I need help coming up with the following query: > My table: > +-+--+ > | rowID | dateOfPurchase | > +-+--+ > | 1 | '2004-1-17 08:00:00'

Re: Indexing problem with UTF8 in 4.1.4?

2004-09-30 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Kevin Cowley <[EMAIL PROTECTED]> writes: > If I knew why I wouldn't be asking. Now by our reconing the key of the > fields is 343 bytes, encoding in UTF8 makes that key 343 bytes Not 1000 > since under utf8 each character is encode in 8 bits. What makes you think s

Re: (if !update then insert) sequence - result Duplicate key :(

2004-09-30 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Aleksandr V. Dyomin" <[EMAIL PROTECTED]> writes: > $key='somekeyvalue'; > dbquery("update sometable set count=count+1 where keyfield='$key'"); > if(mysql_affected_rows()<1) > dbquery('insert into sometable set keyfield='$key', count=1'); > --- > First questi

Re: importing data into mysql from oracle using a text file

2004-09-30 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> writes: > Thanks, it is working for the mentioned format. > Is there any method for importing directly the spooled file from oracle without > changing the file format into the required format like using tab and newline. I don't know Oracle,

Re: (if !update then insert) sequence - result Duplicate key :(

2004-09-30 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Laercio Xisto Braga Cavalcanti" <[EMAIL PROTECTED]> writes: > Hi, > To solve this you can use the REPLACE command. The problem is that Aleksandr wants to increment a counter, not set it to some fixed value. How could you use REPLACE for that? -- MySQL General

Re: CREATE VIEW gets all mangled up when doing SHOW CREATE VIEW

2004-10-05 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Martijn Tonies" <[EMAIL PROTECTED]> writes: > This is plain rubbish. See my other example with a more complicated > view source. When adjusting the view, or extracting a script - the > view source becomes complete gibberish. > MS SQL, or Firebird, for example, sto

Re: CREATE VIEW gets all mangled up when doing SHOW CREATE VIEW

2004-10-05 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Martijn Tonies" <[EMAIL PROTECTED]> writes: > Hello Harald, others, >> > This is plain rubbish. See my other example with a more complicated >> > view source. When adjusting the view, or extracting a script - the >> > view source becomes complete gibberish. >> >>

Re: CREATE VIEW gets all mangled up when doing SHOW CREATE VIEW

2004-10-05 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Jochem van Dieten <[EMAIL PROTECTED]> writes: > Since the is no requirement to have an accessible DEFINITION_SCHEMA > there may be a mechanism to recreate the definition on the fly from > other information, but the same goes for the other view related base > tables

Re: Ask for help on a mysql problem

2004-10-19 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Martijn Tonies" <[EMAIL PROTECTED]> writes: > That is ONE way to store a tree structure :-) > Another would be: > ITEMS > (ItemID INT AUTO_INCREMENT PRIMARY KEY NOT NULL, > other stuff) > ITEM_PARENT > (ItemID int, > ParentID int > primary key (ItemID, ParentID

Re: SELECTING Non existing Dates

2004-10-20 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes: > With a LEFT JOIN you will get back your "zero hours" only if there exist > records in the Timesheets table that match no records in the projects > table. If you have no Timesheets data for the 23rd or 24th, then you > can't have any r

Re: How to make 1 primary key work for 2 columns????

2004-10-21 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Scott Fletcher" <[EMAIL PROTECTED]> writes: > Sorry you didn't understand what's I'm asking for. It take some logical > thought to see the picture. Now I know I will have to enforce it with > the application code (PHP, HTML and JavaScript) with the current two >

Re: Partial Row Reads?

2004-10-22 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Ken Gieselman <[EMAIL PROTECTED]> writes: > The second issue is query performance. It seems that regardless of > what fields are selected, it reads the entire row? Since a monthly > table averages 840GB, this takes a while, even on a well-organized > query like 'S

Re: Calculating a value based on an aliased column

2004-10-26 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Eamon Daly" <[EMAIL PROTECTED]> writes: > SELECT > CASE > WHEN in_method = 'Add' THEN value + in_value > WHEN in_method = 'Subtract' THEN value - in_value > WHEN in_method = 'Multiply' THEN value * in_value > WHEN in_method = 'Divide' THEN value / in_value

Re: bug or feature, <> 'blah' does NOT work with null records

2004-10-28 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, matt_lists <[EMAIL PROTECTED]> writes: > I cant tell if this is a bug or a feature. > Select from table where col <> 'blah' > I use this all the time with other databases, works great, gives me > everything that's not "blah" If those "other databases" return also

Re: bug or feature, <> 'blah' does NOT work with null records

2004-10-28 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Jigal van Hemert" <[EMAIL PROTECTED]> writes: > NULL is meant to indicate that the value is unknown. If a value is unknown > it can be anything. > So, in the example `col` <> 'blah', col can be anything, including 'blah'. > If you take that into consideration the o

Re: Fw: column choices for certain data

2004-10-29 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Rhino" <[EMAIL PROTECTED]> writes: >> The chief advantage of 'SET', as far as I can tell from the manual, is > that >> it lets you control the specific values which can be in a column without >> having to write application lookups to verify that the value you are >

Re: Updating rows from a query

2004-11-02 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Stephen Rasku <[EMAIL PROTECTED]> writes: > I am using the C API with MySQL 4.0.17 on QNX 6.2.1b. > I want to update the rows that are returned as I get them. Is this > possible. Here's a simplified version of what I am trying to do: > query = "select seqNo, prio

Re: InnoDB problem, yet performance increased!?

2004-11-02 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, James Green <[EMAIL PROTECTED]> writes: > Unfortunately when we repeated on the live server, whilst we got a > 200% performance boost (estimate) again, we failed to notice that > innodb is in DISABLED state, and yet alter table returned ok. It's one of the ugliest

Re: Updating rows from a query

2004-11-02 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Stephen Rasku <[EMAIL PROTECTED]> writes: >> I guess this is an oversimplification. Often you can use a single SQL set >> operation instead of a loop. Your example would probably be the same as >> >> UPDATE packet >> SET timestamp = now() >> WHERE timestamp < now

Re: Trans.: Re: Read locks with InnoDB?

2004-11-10 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Julien ALLANOS <[EMAIL PROTECTED]> writes: > Thanks, I've already read these pages. > Here is a test example I've done: > 1/ User A: SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED; > 2/ User B: SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED; > 3/ Use

Re: Trans.: Re: Read locks with InnoDB?

2004-11-10 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Julien ALLANOS <[EMAIL PROTECTED]> writes: > Well, I've tried the following scenario: > 1/ User A: SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED; > 2/ User B: SET GLOBAL TRANSACTION ISOLATION LEVEL READ COMMITTED; > 3/ User A: START TRANSACTION; > 4/ User B

Re: GIS - NULL columns

2004-11-10 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Rafal K." <[EMAIL PROTECTED]> writes: > I installed mySQL server from Wizard and then i create table: > create table geom ( g POINT) ENGINE = MYISAM; > but i can't add any object to the table. I wrote: > insert into geom values(PointFromText('POINT(1,1)')); > and t

Re: enum TRUE/FALSE

2004-11-10 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes: > I would suggest that if you want to compare against FALSE that you make > that one of your enumerated values. I would also make FALSE your default > value and the field not nullable. That way you don't have 3 possible > values to compa

Re: order by question

2004-11-24 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, dan orlic <[EMAIL PROTECTED]> writes: > i have an question about ordering a set of records... > ab c d > - > 1Tax 120001.33 > 1Tax 115002.5

Re: Is this the best/fastest solution?

2004-12-03 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Jigal van Hemert" <[EMAIL PROTECTED]> writes: > Two tables (simplified, because other fields are not used in query; indexes > other than primary key removed): > CREATE TABLE `msg_content` ( > `msg_id` int(14) NOT NULL auto_increment, > `subject` varchar(255) N

Re: "How do I ..." SQL question

2005-01-18 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes: > SELECT DISTINCT place FROM a ; > place > --- > south > west > east > Note that the place north does not appear in the last result > because north was only visited by bob in 2005 and kim in 2004, > records which are not i

Re: Help with a query using multiple LEFT JOINS

2005-02-01 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Graham Cossey" <[EMAIL PROTECTED]> writes: > I'm hoping someone can help with a little problem I'm having with a query. > In the query below I wish to return as least one row per tbl1, however I am > only getting rows where there is at least an entry for tbl2 : >

Re: Using REGEXP

2004-06-30 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes: > SELECT t1.* > FROM ytbl_development t1 > INNER JOIN tmpShortCodes sc > ON INSTR(t1.txtDevPostCode, sc.short_code) =1 This is the same as SELECT t1.* FROM ytbl_development t1 INNER JOIN tmpShortCodes sc ON t1.txtDevPostCode LIKE

Re: slow response time

2004-07-07 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Jeremy Zawodny <[EMAIL PROTECTED]> writes: >> > Using the query cache at all? >> >> Not sure... I'm using the values for caches and whatnot from the >> my-large.cnf in the distribution. > The my-large.cnf I'm looking at has a 16M query cache, but doesn't > explic

Re: Space is filling up

2004-07-09 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, gerald_clark <[EMAIL PROTECTED]> writes: > Asif Iqbal wrote: >> Jack Coxen wrote: >> >>> If you database contains time-based data you could age out old records. I >>> only need to keep data for 6 months so I run a nightly script to delete any >>> records more tha

Re: Which records are not contained in 2 different tables?

2004-07-11 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Jeff Gannaway <[EMAIL PROTECTED]> writes: > I've got one huge table (table a), and two smaller tables (tables b and c) > I need to find which records in 'table a' are not in 'table b' nor are > they in 'table c'. > The Primary Key for all 3 tables is 'ProductID'.

Re: Why this query doesn't group the email addresses?

2004-07-14 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Justin Swanhart <[EMAIL PROTECTED]> writes: >> Where is the implicit group? The 'order by' >> shouldn't effect how things >> are grouped. On MySQL 4.0.17: > Wow. I wasn't aware. Is that expected behavior? > Other databases (Oracle) generate an error when you >

Re: query w multiple tables and expressions

2004-07-15 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Salzgeber Olivier <[EMAIL PROTECTED]> writes: > I need to create a search Query to find all the hotels which have specific > services and sparetime activities. > For example: > Search for hotels where location is "Bern" and the hotel has sparetime > activity 2 and

Re: Need MORE help with query after all...

2004-07-16 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes: > Have you considered splitting this into two queries? One query can gather > information from your token and token_ins tables. The other would join the > first queries results to the other tables to complete your original query. > Depen

Re: Performance of big table

2004-07-21 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Batara Kesuma <[EMAIL PROTECTED]> writes: > Hi, > I use InnoDB for my table, and I think I have hit the point where I > can't do query optimization any more. > The query is as simple as below: > SELECT SQL_NO_CACHE diary_id, LEFT(body, 28) AS body , id FROM > diar

Re: Splitting data across tables

2004-07-22 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Andrew Hill" <[EMAIL PROTECTED]> writes: > Hi, > Okay, cool. A couple of things: > 1) We *think* that our bottleneck is RAM and the calculation of indexes > when inserting into the table (about 500 million rows). There's > certainly plenty of CPU and disk I/O left

Re: Last insert id problem/bug

2004-07-23 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Scott Haneda <[EMAIL PROTECTED]> writes: > I am not sure this is just how it is, my issue, or a bug, I searched the > bugs database, but don't really know what to call this in order to properly > look up the info: > MySQL 4.0.18-standard > CREATE TABLE `addresses`

Re: INSERT if record NOT EXISTS

2004-07-27 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Adaikalavan Ramasamy <[EMAIL PROTECTED]> writes: > This seems more like the solution I want. I am using perl-DBI and when > there is an error (i.e. duplicate insert), the rest of the scrip it not > executed. But this is gives me the following error. What am I doing

Re: How to show comments/annotations in MySQL client output

2004-07-27 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Michael Stassen <[EMAIL PROTECTED]> writes: > Richard Mixon (qwest) wrote: >> I run some mysql command files (just SQL statements in a file I read >> from standard input) and need to place some annotiations/comments in the >> output. >> If I place standard SQL comm

Re: Innodb assertion failure after binary backup-restore

2004-07-27 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Sp.Raja" <[EMAIL PROTECTED]> writes: > Hi, > I was able to solve this by calling sync command, as my previous mail say. > Do you mean to say this will not work regardless of the whether we > sync or not?? If it happens to work, then only by incident. I wouldn't r

Re: selects with wildcards for field/column names

2004-07-30 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Jason Joines <[EMAIL PROTECTED]> writes: > Is it possible to use a wildcard for field names in a select? Nope. > For instance if I have a table with a hundred columns... ... then you have probably a broken DB design. What are you trying to do? --

Re: InnoDB TableSpace Question

2004-08-04 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Jeff Mathis <[EMAIL PROTECTED]> writes: > my understanding is that the datafiles are created when the server > initializes, and this this is the designed and expected behavior. Most > other database products use a similar model. Your scenario cannot > happen. You sp

Re: Mixing Innodb & MyISAM tables

2004-08-07 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, sean c peters <[EMAIL PROTECTED]> writes: > Im considering a design that mixes InnoDB and MyISAM tables. I want Innodb for > speed, etc, but i have one table where i want a column to have a FULLTEXT > index on. Thus the need for MyISAM. > Im not worried about the

Re: Pattern Matching

2004-08-11 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Jason Glicken" <[EMAIL PROTECTED]> writes: > I have 2 tables set up in MySQL, one with a dialed number field and > duration, the other with a list of country codes, there names, and the > rates. I am trying to match the dialed number with country code. My > probl

Re: HelpPlease: Conditional loop confusion

2004-09-14 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes: > Don't do an "@usrDays", just stick the number in there so that the > statement you create looks exactly like the one you tested with. > If you get a "number" from a user from a form, just put that value into > the string. For instance

Re: HelpPlease: Conditional loop confusion

2004-09-14 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Stuart Felenstein <[EMAIL PROTECTED]> writes: > Not sure exactly what you mean by a SQL injection > attack. I'm thinking a string could be input as > opposed to an integer ? Exactly - especially an SQL string. > The form itself constricts user to a set of choices

Re: HelpPlease: Conditional loop confusion

2004-09-14 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] writes: > I agree and I am sorry I forgot a very basic security practice. You must > always check any input from a user. Make sure that the user gives you a > valid number and reject the request if it is anything out of your > acceptable range

Re: Custom Auto-Increment Problem

2004-09-22 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Dan Tappin" <[EMAIL PROTECTED]> writes: > Hi Shawn, > First off thanks for the tip. I had read that page once already but after reading > twice again after your post I realized that the > answer was right there. Wrapping that concept around my brain really hurt

Re: Custom Auto-Increment Problem

2004-09-22 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, "Dan Tappin" <[EMAIL PROTECTED]> writes: > Actually it's not a total and can't be calculated. > The idea is that as users (with individual id_client keys) add rows the id of the > row is auto incremented for their key only. > Example: > If user A adds 3 rows: > i

  1   2   >