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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

syntax problem

Status
Not open for further replies.

hyy1109

IS-IT--Management
Dec 16, 2002
27
US
The following gives syntax error. Why? Thanks.

SELECT *
FROM LeaseLOS
WHERE (WellID IN (select wellid from wells where leaseid in (38, 40))
 
This is, almost assuredly, not the cause... nor the cure, but try:

SELECT *
FROM LeaseLOS as L
WHERE (L.WellID IN (select w.wellid from wells as w where w.leaseid in (38, 40))

As said, that's probably not it, but you may be suffering from ambiguous references to both "leasid" and "wellid".

[red]Note:[/red] [gray]The above comments are the opinionated ravings of Mr3Putt. As such, Mr3Putt accepts no responsibility for damages, real or contrived, resulting from acceptance of his opinions as fact.[/gray]
 
You are missing a ) from the end.

Code:
SELECT     *
FROM         LeaseLOS
WHERE     (WellID IN (select wellid from wells where leaseid in (38, 40))[COLOR=red])[/color]

Denny

--Anything is possible. All it takes is a little research. (Me)

[noevil]
 
Added ) and it is working now. Thanks.
 
no problem.

Denny

--Anything is possible. All it takes is a little research. (Me)

[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top