Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
|
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 17th, 2008, 08:03 PM
Registered User
 
Join Date: Jan 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help joining tables and restricting records

I need to write an SQL query that joins two tables in my database and uses an INNER join to restrict record selection to a field like zipcode or social security number..

When I parse the following query:

select * from EMPLOYEE join JOB_TITLE on EMPLOYEE.JobID = JOB_TITLE.JobID Where zipcode Inner '08801' and '08899'

I receive the following error:
Msg 4145, Level 15, State 1, Line 76
An expression of non-boolean type specified in a context where a condition is expected, near 'inner'

Numerous alterations and I can't seem to get it.. Any help is greatly appreciated..

 
Old January 17th, 2008, 09:51 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Do you mean this:

   WHERE zipcode IN('08801','08899')

-Peter
 
Old January 17th, 2008, 11:51 PM
Friend of Wrox
 
Join Date: Oct 2007
Posts: 130
Thanks: 0
Thanked 3 Times in 3 Posts
Send a message via AIM to urtrivedi
Default


select * from EMPLOYEE inner join JOB_TITLE on EMPLOYEE.JobID = JOB_TITLE.JobID Where zipcode In( '08801' and '08899')



urt
 
Old January 18th, 2008, 02:45 PM
Registered User
 
Join Date: Jan 2008
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That did the trick.. Thanks alot guys..:)






Similar Threads
Thread Thread Starter Forum Replies Last Post
joining tables pit_bait SQL Language 2 September 28th, 2007 07:29 AM
Joining Three Tables Alexpizzoferro Classic ASP Databases 5 September 1st, 2006 04:08 PM
joining 3 tables koskalgr MySQL 5 March 24th, 2006 09:52 AM
Rows to columns by joining to tables subhasis SQL Server 2000 0 February 7th, 2005 09:26 AM
Joining two tables rajustha SQL Server 2000 1 December 7th, 2003 07:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.