Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Select Statement - Add Command

Status
Not open for further replies.

lauriebizz

Technical User
Sep 19, 2005
53
US
Crystal 9 /SQL

I've got a report that pulls from both an excel file (provided by client) and our SQL DB. I'd like a select statement to only select items that have a product code of 'FG' from our DB, but include any locations from the excel file that do not have an order associated with it. The key field is the location # on the excel sheet and the db table.
I tried the statement with no luck:

select {item.item} where {item.product_code} = 'FG'

Error message is "Syntax error or access violation"

But obviously, I have no idea what I'm doing. Any help?
Thanks-
Laurie
 
You'd find it simpler to LINK (not import) the two tables into MS Access and use queries within to resolve. Or you can DTS the Excel file inot the SQL Server db and use queries within.

I would think that a UNION ALL would suit this need, something like:

select location from sqldb where productcode = "FG"
UNION ALL
select location from exceltbl where
location not in
(
select location from sqldb
)

My point is that Crystal will be very inefficient for this, and you can't use a single Add Command against disparate data sources.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top