Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 17th, 2008, 08:03 PM
Registered User
 
Join Date: Jan 2008
Location: Rahway, NJ, .
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..

Reply With Quote
  #2 (permalink)  
Old January 17th, 2008, 09:51 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Do you mean this:

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

-Peter
Reply With Quote
  #3 (permalink)  
Old January 17th, 2008, 11:51 PM
Friend of Wrox
 
Join Date: Oct 2007
Location: , , .
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
Reply With Quote
  #4 (permalink)  
Old January 18th, 2008, 02:45 PM
Registered User
 
Join Date: Jan 2008
Location: Rahway, NJ, .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 07:25 PM.


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