473,385 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

mysql select checking for null characters

tolkienarda
316 100+
hi all
i dynamicaly generate a select statement and there seems to be a problem with it.
below is an example of one that is generated
Expand|Select|Wrap|Line Numbers
  1. SELECT TITLE, FNMI, SALUTATION, COMPANY, E_MAIL FROM DBASE WHERE BOARD IS NOT NULL, OR CBM IS NOT NULL, OR LEGIS IS NOT NULL
  2.  
when i paste it into the sql part of phpmyadmin i get the following error
Expand|Select|Wrap|Line Numbers
  1. #1064 - 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 ' OR CBM IS NOT NULL , OR LEGIS IS NOT NULL  LIMIT 0, 30' at line 1 
  2.  
all of the capital letters are because someone made this database in microsoft access, and she apparently likes caps. I have never used 'OR' or IS NOT NULL in my select statements before and maybe there is somthing wrong with that syntax

i would love some help

eric
Apr 26 '07 #1
2 3825
Hi,

The Syntax for the query is wrong:

Use the Below query,

SELECT TITLE, FNMI, SALUTATION, COMPANY, E_MAIL FROM DBASE WHERE BOARD IS NOT NULL OR CBM IS NOT NULL OR LEGIS IS NOT NULL;

There can't be Comma seperator in the query, i mean in the where clause of the query.

Thanks,
Scarlet




hi all
i dynamicaly generate a select statement and there seems to be a problem with it.
below is an example of one that is generated
Expand|Select|Wrap|Line Numbers
  1. SELECT TITLE, FNMI, SALUTATION, COMPANY, E_MAIL FROM DBASE WHERE BOARD IS NOT NULL, OR CBM IS NOT NULL, OR LEGIS IS NOT NULL
  2.  
when i paste it into the sql part of phpmyadmin i get the following error
Expand|Select|Wrap|Line Numbers
  1. #1064 - 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 ' OR CBM IS NOT NULL , OR LEGIS IS NOT NULL  LIMIT 0, 30' at line 1 
  2.  
all of the capital letters are because someone made this database in microsoft access, and she apparently likes caps. I have never used 'OR' or IS NOT NULL in my select statements before and maybe there is somthing wrong with that syntax

i would love some help

eric
Apr 27 '07 #2
tolkienarda
316 100+
perfect thanks a million

eric
Apr 27 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Phil Powell | last post by:
The table already has a fulltext index and from there I can use the MySQL fulltext search query to get results as well as the relevancy score. The problem I have is that MySQL has a default...
6
by: aa | last post by:
I use the following fragment of code to output datf from MySQL: ====================================================== $chan = mysql_connect ($db_host, $username, $password); mysql_select_db...
0
by: Lenz Grimmer | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, MySQL 4.0.14, a new version of the popular Open Source/Free Software Database, has been released. It is now available in source and binary...
0
by: Mike Chirico | last post by:
Interesting Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Copyright (GPU Free Documentation License) 2004 Last Updated: Mon Jun 7 10:37:28 EDT 2004 The latest...
1
by: jlee | last post by:
I'm pretty much a newbie on mysql, and I need some help. I am running mysql Ver 12.22 Distrib 4.0.24, for portbld-freebsd5.4 (i386) on a server hosting an active website. The site's developer...
6
by: Ridge Burner | last post by:
Can someone tell me which of these 2 SQL queries will be more efficient? I'm having a debate with another guy about which would be less resource intensive for MySQL. The first uses MySQL to pick...
2
by: vncntj | last post by:
I'm trying to get the venue in the 'List' column when in contains a value. But if the venue Is Null then place the event in the 'List' SELECT CASE WHEN event Is Null THEN venue Else event...
6
Atli
by: Atli | last post by:
This is an easy to digest 12 step guide on basics of using MySQL. It's a great refresher for those who need it and it work's great for first time MySQL users. Anyone should be able to get...
1
ssnaik84
by: ssnaik84 | last post by:
Hi Guys, Last year I got a chance to work with R&D team, which was working on DB scripts conversion.. Though there is migration tool available, it converts only tables and constraints.. Rest of...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.