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:
  #1  
Old April 18th, 2007, 10:13 PM
nannuchoudhary nannuchoudhary is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 3 nannuchoudhary User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 m 10 sec
Reputation Power: 0
Exclamation I am not getting the result of query though it is running

Hi all
I want a output like that
I have one table device in which some fileds are there and values are present i want to sort the records by the name filed of the device but with one condition is that the name filed value ='Miscellaneous' should come in the last.
The Query is
(SELECT ID,NAME,VALUE,DESCRIPTION,SHOW_ORDER,CREATED_BY,MO DIFIED_BY,DATE_CREATED,DATE_MODIFIED FROM DEVICE WHERE NAME <>'Miscellaneous' ORDER BY NAME) UNION (SELECT ID,NAME,VALUE,DESCRIPTION,SHOW_ORDER,CREATED_BY,MO DIFIED_BY,DATE_CREATED,DATE_MODIFIED FROM DEVICE WHERE NAME='Miscellaneous');

It is running succesfully but it is showing the records as select * from device

Can any one help in who to write that query and whats the problem in my query.

Reply With Quote
  #2  
Old April 18th, 2007, 10:20 PM
requinix requinix is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 6 requinix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 51 m 36 sec
Reputation Power: 0
Ummm... look at those two WHEREs, everything else is the same. You're combining everything where A is the same as B, and where A is not the same as B.

A UNION doesn't just add the results from one query to another, it runs both queries at once.

Reply With Quote
  #3  
Old April 18th, 2007, 10:41 PM
nannuchoudhary nannuchoudhary is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 3 nannuchoudhary User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 m 10 sec
Reputation Power: 0
Quote:
Originally Posted by requinix
Ummm... look at those two WHEREs, everything else is the same. You're combining everything where A is the same as B, and where A is not the same as B.

A UNION doesn't just add the results from one query to another, it runs both queries at once.



Can u write the Qurey for that condition but i am writing the same query in the other tables that is running fine and also gives the correct result

i want the result as

Name Value Description show_order
Abtile 5 Abite 3
Baulti 2 baulti 5
Mausi 1 Mausi 2
Trico 2 Trico 5
Miscellaneous 3 Miscellaneous 2

Reply With Quote
  #4  
Old April 19th, 2007, 01:13 AM
nannuchoudhary nannuchoudhary is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 3 nannuchoudhary User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 m 10 sec
Reputation Power: 0
can any tell the query which stated above wothout use of union because i am using mysql 3.2 i am not sure where union is supported in mysql 3.2

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > I am not getting the result of query though it is running


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
Stay green...Green IT