473,553 Members | 2,899 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I am a newbie to mysql.plz help!.How to order the records in a table such that.......

28 New Member
How to order the records in a table such that the elements in a field strating with a particular alphabet apper first.

ie.,the elements in the field names are as follows:

amar
Bob
joy
mana
sana
xena

I want it as: If 'm' is my input then 'mana' must apper first but all the records must also appear.

something like this:
mana
sana
xena
amar
Bob
joy.

Hoping that anyone of you will help me>>>>>>>..

Thanks i advance.
-ram
Dec 15 '06 #1
1 1267
ronverdonk
4,258 Recognized Expert Specialist
Use a UNION to append the rows >= criteria with the rows < criteria, as follows:
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM table 
  2.       WHERE SUBSTR(name,1,1) >= 'M' 
  3.       UNION 
  4.       SELECT * FROM table 
  5.       WHERE SUBSTR(name,1,1) < 'M';
  6.  
Ronald :cool:
Dec 18 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2629
by: Girish Agarwal | last post by:
--0-474210375-1058976151=:31789 Content-Type: text/plain; charset=us-ascii Content-Id: Content-Disposition: inline Note: forwarded message attached. __________________________________
0
1003
by: Annie Xie | last post by:
Any one could help? 1> anyone has a compiled tarball for mysql new version (-4.0 up) for solaris 2.6 can be shared? The OS was patched latest. 2> I'm trying build it, configure w/o any problem. However, when doing make, it failed w/ error: make: Entering directory `/software/pkg/mysql-4.0.14/client' source='mysql.cc' object='mysql.o'...
0
1471
by: Yun Guan | last post by:
Hello mysql gurus, I am trying to run perl on mysql database on Red Hat box. I want to install DBI and DBD:mysql using CPAN: perl -MCPAN -e shell cpan>install DBI The above succeeded, but cpan>install DBD::mysql
0
1865
by: ./Rob & | last post by:
Hi gang: I'm experiencing a problem with MySQL -- I updated MySQL from version 4.1.0 to 4.1.10 and now when I login as root it doesn't show all the databases I should have access to, nor it doesn't recognize me being logged in as root (via CURRENT_USER().) Here it is, line-by-line. Inline comments are denoted by '//'
1
3615
by: smsabu2002 | last post by:
Hi, I am facing the build problem while installing the DBD-MySql perl module (ver 2.9008) using both GCC and CC compilers in HP-UX machine. For the Build using GCC, the compiler error is produced due to the unknown GCC compiler option "+DAportable". For the Build using CC, the preprocessor error is produced due to the recursive...
0
3454
by: pvannie | last post by:
Hello there, I've been trying to install DBD::mysql on Mac OS X Server 10.3 for 2 days, but it still raises error. So I'm going to send this message to ask for help. Any help will be much appreciated. Here is what I've tried to install the DBD::mysql module: 1> Download DBD-mysql-2.9003 and un-zip it 2> cd to DBD-mysql-2.9003 directory
1
2289
by: pvannie | last post by:
Hello there, I've been trying to install DBD::mysql on Mac OS X Server 10.3 for 2 days, but it still raises error. So I'm going to send this message to ask for help. Any help will be much appreciated. Here is what I've tried to install the DBD::mysql module: 1> Download DBD-mysql-2.9003 and un-zip it 2> cd to DBD-mysql-2.9003 directory
1
1648
by: usmdog | last post by:
I am trying to setup MySql 4.0.2.6 according to my school book "PHP fast&easy web development" on a WinXP Professional SP2 system. Everytime I try to create a database this message below comes up. If you can please give me any assistance, I would greatly appreciate it. mysqladmin: CREATE DATABASE failed; error: 'Access denied for user:...
2
1174
by: gavilaso | last post by:
Hi, i'm completly a newbie on PHP, I'm trying to make a static site search where i'm giong to put 2 category on a combobox for query.. box 1 Citys Carolina San Juan Ponce Box 2 Computers
8
1566
by: wizardry | last post by:
Hello - as the title states i'm a newbie to php! This is what i would like to do: start a session to caputure data from the user then when they submit the data to be stored in mysql db the page will redirect into another page on the form action.
0
7568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7492
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7772
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7852
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6109
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5133
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3537
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1106
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
808
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.