ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 17th, 2005, 01:31 PM
Kevin Andreshak Kevin Andreshak is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Hawaii
Posts: 14 Kevin Andreshak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 55 m 11 sec
Reputation Power: 0
Query Help - Using Inner Joins

I am trying to create a query which uses Inner Join.

The following 2 queries work by themselves, but I need to make them work in 1 query.

==Query 1==

SELECT *
FROM tbl_property
INNER JOIN tbl_cat_one_feat_eight_bet
ON tbl_property.prop_ID = tbl_cat_one_feat_eight_bet.prop_ID
WHERE cat_one_feat_eight_ID = 'c1f8_101'


==Query 2==

SELECT *
FROM tbl_property
INNER JOIN tbl_cat_two_feat_six_bet
ON tbl_property.prop_ID = tbl_cat_two_feat_six_bet.prop_ID
WHERE cat_two_feat_six_ID = 'c2f6_101'

=========

I tried using UNION and UNION ALL, but it would not work properly

Any help trying to put these 2 queries together would be appreciated.

Thank you

Reply With Quote
  #2  
Old June 17th, 2005, 03:21 PM
Bastion Bastion is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 181 Bastion User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 4 h 23 m 47 sec
Reputation Power: 4
Have you tried merging them with ()? For example

Code:
SELECT *
FROM (tbl_property
INNER JOIN tbl_cat_one_feat_eight_bet
ON tbl_property.prop_ID = tbl_cat_one_feat_eight_bet.prop_ID) INNER JOIN tbl_cat_two_feat_six_bet
ON tbl_property.prop_ID = tbl_cat_two_feat_six_bet.prop_ID
WHERE cat_one_feat_eight_ID = 'c1f8_101'

Reply With Quote
  #3  
Old June 17th, 2005, 04:21 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,655 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 13 h 29 m 8 sec
Reputation Power: 53
A union will only work if there are the same number of columns in both queries with the same column name.

As an aside, you can see if the help found in this forum works for you, but be aware that this forum is really for ColdFusion. Devshed has numerous other forums devoted specifically to SQL and database development. You'd probably get much better luck in one of those.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Query Help - Using Inner Joins


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway