------解决方案--------------------
这个location的值从哪里取出来的呢?是不是前台页面传进来的?
------解决方案--------------------
...跟几个表有什么关系。
你的"select * from InWasteInfo where Location = '" + l + "层" + r + "行" + c + "列'"可以。
那么"select * from G2 where 名称 in (select 名称 from G1 where Location = '" + l + "层" + r + "行" + c + "列')" 就绝对可以。
即使出问题,也不是SQL端的事了。

另这跟模糊查询有啥关系,哪模糊了? 
------解决方案--------------------
这个你肯定需要写个存储过程接收程序传过来的参数,然后用动态SQL实现

CREATE PROCEDURE <Procedure_Name, sysname, ProcedureName> 
@floor int,
@row int,
@col int
AS
BEGIN
declare @sql varchar(max)
set @sql = 'select * from G2 where 名称 in (select 名称 from G1 where Location = '+@floor+'层'+@row+'行'+@col+'列)'
exec(@sql)
END
GO


------解决方案--------------------
用execute('sql语句')或者sp_executesql,动态执行sql语句的方法,可以用变量的形式
  相关解决方案