Re: need help with select statement
At 4:20 -0500 7/7/03, Anthony Scism wrote: I am relatively new at this, but is there any way to perform the following: | obs_date | date | YES | | NULL | | | obs_time | time | YES | | NULL | | | object | varchar(40) | YES | | NULL | | | observing_site | varchar(40) | YES | | NULL | | | constellation | varchar(40) | YES | | NULL | | | seeing | varchar(80) | YES | | NULL | | | magnitude | decimal(6,2) | YES | | NULL | | | temperature| decimal(6,2) | YES | | NULL | | | size | decimal(6,2) | YES | | NULL | | | telescope | varchar(40) | YES | | NULL | | | r_a| varchar(20) | YES | | NULL | | | d_e_c | varchar(20) | YES | | NULL | | | eyepiece | varchar(20) | YES | | NULL | | | magnification | int(11) | YES | | NULL | | | filter | varchar(40) | YES | | NULL | | | observer | varchar(40) | YES | | NULL | | | notes | varchar(254) | YES | | | | | imgurl | varchar(254) | YES | | NULL | | | key| int(11) | | PRI | NULL | auto_increment | | key_pls_email | varchar(100) | | | key+observer | | ++--+--+-+--+--- -+ select * from table where key = 1; or select * from table where key = '1'; both of these return an error of: mysql> select * from observ_log where key=1; ERROR 1064: You have an error in your SQL syntax near 'key=1' at line 1 mysql> select * from observ_log where key='1'; ERROR 1064: You have an error in your SQL syntax near 'key='1'' at line 1 I can not find anything regarding using the primary key in the where expression. key is a reserved word, so write your WHERE clauses like this ... WHERE `key` = 1; ... WHERE `key` = '1'; any help would be greatly appreciated. A Scism [EMAIL PROTECTED] -- Paul DuBois, Senior Technical Writer Madison, Wisconsin, USA MySQL AB, www.mysql.com Are you MySQL certified? http://www.mysql.com/certification/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: need help with select statement
No, no you are welcome. I made a reserved word list and some other stuff, which is not complete yet. I concentrate on topics which I (personally) would like to be covered more detailed than it is done in the original MySQLmanual. http://www.knowd.co.jp/staff/nils Feel free to browse around, but be aware that the one or the other statement made by me on the page might be incomplete yet or contains perhaps even wrong information. If this would be the case than I would certainly appreciate any comment or feedback. Best regards Nils Valentin Tokyo/Japan 2003年 7月 7日 月曜日 18:49、Anthony Scism さんは書きました: > Thank you very much, I should have thought of that. > > -Original Message- > From: Nils Valentin [mailto:[EMAIL PROTECTED] > Sent: Monday, July 07, 2003 4:34 AM > To: Anthony Scism; [EMAIL PROTECTED] > Subject: Re: need help with select statement > > > Hi Antony, > > Eventually "key" is a reserved word ?? ;-) > > nice one !! > > Best regards > > Nils Valentin > Tokyo/Japan > > 2003年 7月 7日 月曜日 18:20、Anthony Scism さんは書きました: > > I am relatively new at this, but is there any way to perform the > > > > following: > > | obs_date | date | YES | | NULL | > > | > > | obs_time | time | YES | | NULL | > > | > > | object | varchar(40) | YES | | NULL | > > | > > | observing_site | varchar(40) | YES | | NULL | > > | > > | constellation | varchar(40) | YES | | NULL | > > | > > | seeing | varchar(80) | YES | | NULL | > > | > > | magnitude | decimal(6,2) | YES | | NULL | > > | > > | temperature| decimal(6,2) | YES | | NULL | > > | > > | size | decimal(6,2) | YES | | NULL | > > | > > | telescope | varchar(40) | YES | | NULL | > > | > > | r_a| varchar(20) | YES | | NULL | > > | > > | d_e_c | varchar(20) | YES | | NULL | > > | > > | eyepiece | varchar(20) | YES | | NULL | > > | > > | magnification | int(11) | YES | | NULL | > > | > > | filter | varchar(40) | YES | | NULL | > > | > > | observer | varchar(40) | YES | | NULL | > > | > > | notes | varchar(254) | YES | | | > > | > > | imgurl | varchar(254) | YES | | NULL | > > | > > | key| int(11) | | PRI | NULL | > > > > auto_increment | > > > > | key_pls_email | varchar(100) | | | key+observer | > > ++--+--+-+--+--- > > > -+ > > > > select * from table where key = 1; > > or > > select * from table where key = '1'; > > > > both of these return an error of: > > mysql> select * from observ_log where key=1; > > ERROR 1064: You have an error in your SQL syntax near 'key=1' at line > > 1 > > > mysql> select * from observ_log where key='1'; > > ERROR 1064: You have an error in your SQL syntax near 'key='1'' at > > line > > > 1 > > > > I can not find anything regarding using the primary key in the where > > expression. > > > > any help would be greatly appreciated. > > > > A Scism > > [EMAIL PROTECTED] -- --- Valentin Nils Internet Technology E-Mail: [EMAIL PROTECTED] URL: http://www.knowd.co.jp Personal URL: http://www.knowd.co.jp/staff/nils -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: need help with select statement
Hi Antony, Eventually "key" is a reserved word ?? ;-) nice one !! Best regards Nils Valentin Tokyo/Japan 2003年 7月 7日 月曜日 18:20、Anthony Scism さんは書きました: > I am relatively new at this, but is there any way to perform the > > following: > | obs_date | date | YES | | NULL | > | > | obs_time | time | YES | | NULL | > | > | object | varchar(40) | YES | | NULL | > | > | observing_site | varchar(40) | YES | | NULL | > | > | constellation | varchar(40) | YES | | NULL | > | > | seeing | varchar(80) | YES | | NULL | > | > | magnitude | decimal(6,2) | YES | | NULL | > | > | temperature| decimal(6,2) | YES | | NULL | > | > | size | decimal(6,2) | YES | | NULL | > | > | telescope | varchar(40) | YES | | NULL | > | > | r_a| varchar(20) | YES | | NULL | > | > | d_e_c | varchar(20) | YES | | NULL | > | > | eyepiece | varchar(20) | YES | | NULL | > | > | magnification | int(11) | YES | | NULL | > | > | filter | varchar(40) | YES | | NULL | > | > | observer | varchar(40) | YES | | NULL | > | > | notes | varchar(254) | YES | | | > | > | imgurl | varchar(254) | YES | | NULL | > | > | key| int(11) | | PRI | NULL | > > auto_increment | > > | key_pls_email | varchar(100) | | | key+observer | > > ++--+--+-+--+--- > -+ > > select * from table where key = 1; > or > select * from table where key = '1'; > > both of these return an error of: > mysql> select * from observ_log where key=1; > ERROR 1064: You have an error in your SQL syntax near 'key=1' at line 1 > mysql> select * from observ_log where key='1'; > ERROR 1064: You have an error in your SQL syntax near 'key='1'' at line > 1 > > I can not find anything regarding using the primary key in the where > expression. > > any help would be greatly appreciated. > > A Scism > [EMAIL PROTECTED] -- --- Valentin Nils Internet Technology E-Mail: [EMAIL PROTECTED] URL: http://www.knowd.co.jp Personal URL: http://www.knowd.co.jp/staff/nils -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
need help with select statement
I am relatively new at this, but is there any way to perform the following: | obs_date | date | YES | | NULL | | | obs_time | time | YES | | NULL | | | object | varchar(40) | YES | | NULL | | | observing_site | varchar(40) | YES | | NULL | | | constellation | varchar(40) | YES | | NULL | | | seeing | varchar(80) | YES | | NULL | | | magnitude | decimal(6,2) | YES | | NULL | | | temperature| decimal(6,2) | YES | | NULL | | | size | decimal(6,2) | YES | | NULL | | | telescope | varchar(40) | YES | | NULL | | | r_a| varchar(20) | YES | | NULL | | | d_e_c | varchar(20) | YES | | NULL | | | eyepiece | varchar(20) | YES | | NULL | | | magnification | int(11) | YES | | NULL | | | filter | varchar(40) | YES | | NULL | | | observer | varchar(40) | YES | | NULL | | | notes | varchar(254) | YES | | | | | imgurl | varchar(254) | YES | | NULL | | | key| int(11) | | PRI | NULL | auto_increment | | key_pls_email | varchar(100) | | | key+observer | | ++--+--+-+--+--- -+ select * from table where key = 1; or select * from table where key = '1'; both of these return an error of: mysql> select * from observ_log where key=1; ERROR 1064: You have an error in your SQL syntax near 'key=1' at line 1 mysql> select * from observ_log where key='1'; ERROR 1064: You have an error in your SQL syntax near 'key='1'' at line 1 I can not find anything regarding using the primary key in the where expression. any help would be greatly appreciated. A Scism [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Need help with select statement.
Thanks Rolf >From: "Rolf Hopkins" <[EMAIL PROTECTED]> >To: "David Jacobowitz" <[EMAIL PROTECTED]>, ><[EMAIL PROTECTED]> >Subject: Re: Need help with select statement. >Date: Tue, 27 Feb 2001 09:21:57 +0800 > >No it's not possible but you can just read in all tables anyway and ignore >the columns you don't want. > >- Original Message - >From: "David Jacobowitz" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Tuesday, February 27, 2001 7:33 >Subject: Need help with select statement. > > > > Dear Sir, > > > > I have looked in the manual but could not find any clue so I am seeking >your > > assistance. I have a table with 25 fields and I use most of these fields >but > > not all in different DBI scripts. Currently I use: > > > > SELECT field_1, field_4, ...getting tired typing field names... FROM >myTest; > > > > Is it possible to do something like: > > SELECT * FROM myTest EXCEPT field_2, field_3; > > > > Greatly appreciate your help. > > > > David > > > > _ > > Get your FREE download of MSN Explorer at http://explorer.msn.com > > > > > > - > > Before posting, please check: > >http://www.mysql.com/manual.php (the manual) > >http://lists.mysql.com/ (the list archive) > > > > To request this thread, e-mail <[EMAIL PROTECTED]> > > To unsubscribe, e-mail ><[EMAIL PROTECTED]> > > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > _ Get your FREE download of MSN Explorer at http://explorer.msn.com - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Need help with select statement.
No it's not possible but you can just read in all tables anyway and ignore the columns you don't want. - Original Message - From: "David Jacobowitz" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, February 27, 2001 7:33 Subject: Need help with select statement. > Dear Sir, > > I have looked in the manual but could not find any clue so I am seeking your > assistance. I have a table with 25 fields and I use most of these fields but > not all in different DBI scripts. Currently I use: > > SELECT field_1, field_4, ...getting tired typing field names... FROM myTest; > > Is it possible to do something like: > SELECT * FROM myTest EXCEPT field_2, field_3; > > Greatly appreciate your help. > > David > > _ > Get your FREE download of MSN Explorer at http://explorer.msn.com > > > - > Before posting, please check: >http://www.mysql.com/manual.php (the manual) >http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Need help with select statement.
Dear Sir, I have looked in the manual but could not find any clue so I am seeking your assistance. I have a table with 25 fields and I use most of these fields but not all in different DBI scripts. Currently I use: SELECT field_1, field_4, ...getting tired typing field names... FROM myTest; Is it possible to do something like: SELECT * FROM myTest EXCEPT field_2, field_3; Greatly appreciate your help. David _ Get your FREE download of MSN Explorer at http://explorer.msn.com - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php