MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old September 16th, 2005, 10:34 AM
nilay_chaudhari nilay_chaudhari is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 1 nilay_chaudhari User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 m 26 sec
Reputation Power: 0
problem with query

1.select * from m_plan_subdesc SD where SD.plan_subdesc_id in(select plan_subdesc_id from m_planVsubdesc where plan_id=1 and plan_desc_id=1)
if i run this query at server it dosen't work but if i run same query at local mysql ,it works.

and if i divide this query even it works
i.e.
if i run first sub query 2 .(select plan_subdesc_id from m_planVsubdesc where plan_id=1 and plan_desc_id=1)
then it works and gives result

then

using that result i run main query
3 .select * from m_plan_subdesc SD where SD.plan_subdesc_id in(Result of subquery)

then also it works

but if i try the complete above mentioned in 1 query
it doesn't works.

so if any one can have some idea for this problem
please help me.

Reply With Quote
  #2  
Old September 16th, 2005, 06:22 PM
Madpawn Madpawn is offline
My beat is correct.
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 339 Madpawn User rank is Private First Class (20 - 50 Reputation Level)Madpawn User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 22 h 3 m 33 sec
Reputation Power: 4
Check what version your server's running. Subqueries only work in 4.1 and above. You should be able to use a join, though:

Code:
SELECT
 sd.foo
,sd.bar 
FROM
 m_plan_subdesc sd 
INNER JOIN
 m_planVsubdesc sv
ON
 sd.plan_subdesc_id = sv.plan_subdesc_id 
WHERE
 sv.plan_id=1 
AND
 sv.plan_desc_id=1
Comments on this post
MichaelSoft agrees!
__________________
"A pawn is the most important piece on the chessboard -- to a pawn"


Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > problem with query


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 5 hosted by Hostway