Re: if else statement
fre 2006-06-23 klockan 01:52 -0400 skrev Michael Stassen: Thomas Lundström wrote: Not sure what you're aming for here and how your data is structured but why not use a join and alias and fetch all info in one select and then solve what you need in your code? Something in the line of: select t2.col2 from_t2, t3.col2 from_t3 from table1 t1, table2 t2, table3 t3 where t1.id = t2.id and t1.id = t3.id and t1.id = 3 Maybe you can do something like that? That may be a start, but you have the wrong condition on t1.id, and you've left out any mention of t1.col1. Also, explicit JOINs are better than implicit (using commas) JOINs. Well of course you are correct, only probably you've missed the intention. The error is the late-in-the-evening substitution of t1.id = 3 where it should read t1.col1 = 3 of course. Yes, explicit JOINS are always better. These ones are though easier to fiddle with! ;-) Regards, Thomas Lundström -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] #0; -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: if else statement
Not sure what you're aming for here and how your data is structured but why not use a join and alias and fetch all info in one select and then solve what you need in your code? Something in the line of: select t2.col2 from_t2, t3.col2 from_t3 from table1 t1, table2 t2, table3 t3 where t1.id = t2.id and t1.id = t3.id and t1.id = 3 Maybe you can do something like that? Regards, Thomas L. ons 2006-06-21 klockan 17:16 +0800 skrev Song Ken Vern-E11804: 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 table3.id = 1; In Perl I would probably do have to access the DB twice. Select col2 from table1 where if = 1; If (col2 == 3) { Select col2 from table2 where table2.id = 1; } else { Select col2 from table3 where table3.id = 1; } I've read the manual on subqueries but the example don't indicate how I can do a conditional test using a subquery? Am I on the right track or is there another way to do this? Thanks -- Ken e11804 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: set DEC as a column name : forbidden
Hi Gilles! Just use `dec` and it will work fine. DEC is as you suspected a reserved word and can only be used as column namne if you put it in `column`-syntax. Example: create table astronomicalvskeywords ( `dec` float not null, `ra` float not null ); ...will create: desc astronomicalvskeywords; +---+---+--+-+-+---+ | Field | Type | Null | Key | Default | Extra | +---+---+--+-+-+---+ | dec | float | NO | | NULL| | | ra| float | NO | | NULL| | +---+---+--+-+-+---+ 2 rows in set (0.01 sec) Regards Thomas L. tis 2006-05-30 klockan 15:46 +0200 skrev Gilles MISSONNIER: Hello I could not find the answer through the online Search the MySQL manual. I run MySQL 4.1 In astronomy, RA and DEC are widely used coordinate names. Then I try to add a column named DEC : mysql alter table my_table add dec float; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'dec float' at line 1 UPPER case lead to the same error. It seems that the reason is that DEC is a keyword standing for decimal. I do not understand why this cannot be allowed for a column name. Is there a turn around ? This is annoying ; I add to name the column as DECL which is much less meaning full in the astronomy community. thanks, =_==_==_==_==_==_= =¯==¯==¯==¯==¯==¯= Gilles Missonnier IAP - [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Trouble with Virus checkers
Hi Alec, Of course it is an acceptable solution to tell your virus checker to ignore the data files. Another application than the database engine itself should never manipulate the data files of any database engine. And yes, you are right... :-) Running the database server separate from the pc net is a good idea. Put a firewall in between (maybe controlled by your IT-department so they can sleep at night?) and make sure it only allows database traffic. Then you have a solution in the right line of thinking by my book. Regard, Thomas Thomas Lundström, mailto:[EMAIL PROTECTED] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: den 18 januari 2005 11:45 To: mysql@lists.mysql.com Subject: Trouble with Virus checkers My product has at is centre a Windows PC whose sole purpose is to run MySQL plus my middleware layer. However, it installed on a site with a large amount of heterogeneous IT department and an active IT department managing the whole corporate IT structure. This IT department insists that, if it is a Windows PC with any connection to the corporate network, it *must* run a virus checker. However, it appears that the virus checker (McAffee, as it happens, but I think the problem may be general) feels a need to check the MySQL data files every time they change. As the system load is bean ramped up, more and more time is being spent in the virus checker. The quick solution is to tell the virus checker to ignore the whole mysql\data directory. This solves the problem, but leaves the IT department nervous because something is not being checked. I cannot see how a virus could infect via the data directory, but I am no virus expert. It is also my view that a machine with no actual humans using it (no email, no web), with all unnecessary services disabled and which is behind a good firewall should be pretty well protected and should not need a virus checker. Am I right in this? Have other people had this sort of problem, and how did they cope with it? To my regret, the reply switch to *nix is unacceptable to my management. Alec -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: A Beginning User
Hi Robert... Of course it works on you platform. It is strange that you've got it to work for four hours though? Did your read any installation instructions? Maybe you've only started the daemon from a command-prompt and then later closed the command-prompt window? Try starting the \mysql\bin\winmysqladmin.exe tool. Regards, Thomas Lundström Thomas Lundström mailto:[EMAIL PROTECTED] -Original Message- From: Roberto Maisenhelder [mailto:[EMAIL PROTECTED] Sent: den 16 december 2004 12:48 To: [EMAIL PROTECTED] Subject: A Beginning User Hi everybody. I've been testing mysql server for sometime. When I installed the latest version over windows 2000 professional, the mysql service worked for just four hours. I tried to install again and the same problem happened. I'd like to know if anyone had the same kind of problem. Does mysql work properly over windows platform? Thanks Robert _ MSN Messenger: instale grátis e converse com seus amigos. http://messenger.msn.com.br -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: inserting null to not null columns
Hi Donna, You have to include the column `type` in the SQL-statement, otherwise the not specified column will have its indirect null translated to an empty string or 0 (for strings/numeric). A bug or a feature? Actually I've used it as a feature sometimes when using MySQL to move large amount of dirty data between different systems. Be careful when not including NOT NULL columns in your inserts... To get around the problem and get more background info, read: http://dev.mysql.com/doc/mysql/en/constraint_NOT_NULL.html Regards, Thomas Lundström, Ongame E-Solutions AB -Original Message- From: Donna Hinshaw [mailto:[EMAIL PROTECTED] Sent: den 21 september 2004 21:07 To: [EMAIL PROTECTED] Subject: inserting null to not null columns Hi folks: I have an InnoDB database, the tables created using MySQL Control Center 0.9.4-beta (winXP pro platform). Each table has some columns which I have checked as Nulls Allowed. I am building a pure Java GUI to the database. Got the SQL statements working fine, but have discovered that I can successfully insert rows into a table without including a value for a column which should be blocking nulls. e.g. Table A id (PK, auto increment) name type ssn ( nulls allowed specified) == name and type do not have nulls allowed specified, so I think they should be NOT NULL. they also have no default specified. then insert into A (id,name,ssn) values (NULL,Jane,9) this statement works fine, but I think it should give me an error by saying that I'm trying to insert a row without providing a value for the type column (which has no default specified). Looking at the create statement for the tables, MySQL Control Center has supplied defaults of blanks...can I turn off that preference ? using MySQL 4.0.18 Can anyone provide clarification? thanks... Donna -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]