Reply
How to select mySQL question
Old 10-10-2007, 06:26 AM How to select mySQL question
Junior Talker

Posts: 1
Hey there,

I got a question about how to select. My mysql database table has 3 different names in it and looks like this

id (int 11)
firstname (varchar 100)
username (varchar 100)
additional name (varchar 100)
display name (char 1)

now the user can select which name he/she want to show on the site. And that is saved in the display name which is a char --> f for firstname, u for username, a for additional name.

Now i want to select the name the user selected from the table ordered by that name as well, but how i do that?

select [selected_name] from members order by [selected_name] i am kinda lost..

greetings Martin
MLegend is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 10-10-2007, 08:15 AM Re: How to select mySQL question
chrishirst's Avatar
Super Moderator

Posts: 12,442
Location: Blackpool. UK
Point 1. You should NOT have spaces in a column name.

use a CASE statement as in (http://www.webmaster-talk.com/the-da...tml#post466198 )

Just use the column name in place of the text shown in the above example.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to How to select mySQL question
 

Thread Tools

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11743 seconds with 13 queries