4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 Concatenating two SELECT results
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
Hertzsprung
WebHelper
WebHelper


Joined: 30 Jul 2002
Posts: 56
Location: UK

PostPosted: Wed Jul 31, 2002 12:30 pm (15 years, 2 months ago) Reply with QuoteBack to Top

Is there a way to concatenate two sets of results like this:

SELECT UserID, Name FROM Users WHERE Disabled = 0

+

SELECT UserID, Name FROM Users WHERE Disabled = 1 ORDER BY Name

Oh, and is the syntax for those queries correct or do I need "==" instead of "=" ?


Last edited by Hertzsprung on Wed Jul 31, 2002 1:59 pm, edited 1 time in total
OfflineView User's ProfileFind all posts by HertzsprungSend Personal MessageVisit Poster's Website
Hertzsprung
WebHelper
WebHelper


Joined: 30 Jul 2002
Posts: 56
Location: UK

PostPosted: Wed Jul 31, 2002 12:58 pm (15 years, 2 months ago) Reply with QuoteBack to Top

I have done some investigation to find that there is the UNION statement available in MySQL version 4.0.0 or higher. Would it be better to perform the union in PHP and assume MySQL version 3.x on web servers?
OfflineView User's ProfileFind all posts by HertzsprungSend Personal MessageVisit Poster's Website
Darren
Team Member



Joined: 05 Feb 2002
Posts: 549
Location: London

PostPosted: Wed Jul 31, 2002 1:27 pm (15 years, 2 months ago) Reply with QuoteBack to Top

SELECT UserID, Name FROM Users WHERE Disabled = 0 OR Disabled = 1 ORDER BY Name

Wouldn't that give you a list of users where Disabled was 1 or 0.
OfflineView User's ProfileFind all posts by DarrenSend Personal MessageVisit Poster's Website
Hertzsprung
WebHelper
WebHelper


Joined: 30 Jul 2002
Posts: 56
Location: UK

PostPosted: Wed Jul 31, 2002 1:59 pm (15 years, 2 months ago) Reply with QuoteBack to Top

Yes, but I don't want the ones that aren't disabled to be sorted Wink
OfflineView User's ProfileFind all posts by HertzsprungSend Personal MessageVisit Poster's Website
Darren
Team Member



Joined: 05 Feb 2002
Posts: 549
Location: London

PostPosted: Wed Jul 31, 2002 2:33 pm (15 years, 2 months ago) Reply with QuoteBack to Top

i thought that was too easy - I have no idea then Very Happy
OfflineView User's ProfileFind all posts by DarrenSend Personal MessageVisit Poster's Website
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot edit your posts in this forum.
You cannot delete your posts in this forum.
You cannot vote in polls in this forum.


Page generation time: 0.053209 seconds :: 17 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme