Raverse table???

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
siropchik
Forum Newbie
Posts: 3
Joined: Thu Jul 29, 2004 1:47 am

Raverse table???

Post by siropchik »

Hi,I have very strange problem .My big table consists of many records ,part of them is null or empty value .Now a problem:
Then I do Order By 'Some Column_Name' I receive an answer but in wrong way :First of all -it's a empty fields and at finish Results that i need.
Probably you know how can I redirect an answer.
First my search value,after empty fields????
Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

ORDER BY `column` WHERE `column` NOT NULL
?
Draco_03
Forum Regular
Posts: 577
Joined: Fri Aug 15, 2003 12:25 pm
Location: Montreal, Canada

Post by Draco_03 »

You could also put some sort of validation
For exemple if you put first name REQUIRed, well you won't have null field..

(note that this is in the case that you have UNWANTED NULL fields..)
siropchik
Forum Newbie
Posts: 3
Joined: Thu Jul 29, 2004 1:47 am

replay

Post by siropchik »

Yes,I have to have NULL fields too,but in the end
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

if you can perform unions, I'd use one, the first select grabs the non-null ones, the second only the null ones..
siropchik
Forum Newbie
Posts: 3
Joined: Thu Jul 29, 2004 1:47 am

Post by siropchik »

it works but
first: it not sort right;
second: this query has 14 seconds
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it may be better to sort it yourself then.
Post Reply