Solved

Incorrect Syntax near the Keyword 'WHERE'

Posted on 2009-07-10
5
253 Views
Last Modified: 2012-05-07
i try to get the row where field sol.so_bo_suffix is not equal to NULL / Empty.

string strSQLget_selectrow = "Select * FROM sales_order so INNER JOIN sales_order_line sol WHERE sol.so_bo_suffix IS NOT NULL";

MSSQL Server 2005 Express
0
Comment
Question by:doramail05
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 31

Accepted Solution

by:
RiteshShah earned 500 total points
ID: 24821409
try something like this

Select * FROM sales_order so INNER JOIN sales_order_line sol on so.keyfield=sol.keyfield WHERE sol.so_bo_suffix IS NOT NULL
0
 
LVL 42

Expert Comment

by:pcelba
ID: 24821413
You need to define the JOIN condition which connects lines to sales_order table, e.g.:

string strSQLget_selectrow =
"Select * FROM sales_order so INNER JOIN sales_order_line sol ON so.order_num = sol.order_num WHERE sol.so_bo_suffix IS NOT NULL";

You have to replace the column name by the one which exists in your tables.
0
 
LVL 31

Expert Comment

by:RiteshShah
ID: 24821415
You are missing "ON" clause in which you have to define common field between two table.
0
 
LVL 1

Author Comment

by:doramail05
ID: 24821451
resolved..

string strSQLget_selectid = "Select * FROM sales_order so INNER JOIN sales_order_line sol on so.so_order_no = sol.so_order_no WHERE sol.so_bo_suffix IS NOT NULL";
0
 
LVL 31

Expert Comment

by:RiteshShah
ID: 24821460
doramail05,

glad to help!!!, BTW, I was expecting "A" grade but awarded "B" grade, can you please tell me why "B" grade? If I am lacking something in my answer than your comment will help me to improve my own answer quality.

Ritesh Shah

www.SQLHub.com
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have a large data set and a SSIS package. How can I load this file in multi threading?
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question