Where in SQL

chipsworld

Board Regular
Joined
May 23, 2019
Messages
164
Office Version
  1. 365
Was wondering how I can use a Where statement in a SQL qry

Am doing a mail merge, and trying to avoid the rows in the Name column that only contain a function that returns ""

Code:
SQLStatement:="SELECT * FROM `" & wsName & "$`", SQLStatement1:=""
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
ranman256... Ok, so I am a little confused...The wsname is a variable for the sheet and column. Not sure what the"$'" is all about, but it has always been there before...is that where I should place the Where statement? Also...I am guessing that the "Where" statement should be "Where wsName is > """...correct? First time doing this... Trying to skip cells that contain a function that is returning "" since there is no source data.

So.... SQLStatement:="SELECT * FROM `" & wsName & "Where wsName is >""", SQLStatement1:="" or like this: SQLStatement:="SELECT * FROM `" & wsName & "$`", & "Where wsName is >""", SQLStatement1:=""
 
Upvote 0
Is there a way to just merge based on a print area? Maybe that path would yield what I am looking for.
 
Upvote 0

Forum statistics

Threads
1,223,888
Messages
6,175,212
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top