Results 1 to 10 of 17
-
7th Feb 2012, 02:03 PM #1OPMemberWebsite's:
FunLinkz.com Smyu.inSQL Help
This is a easy code but I am not able to figure it as Im fairly new to SQL.
Example I have a table like this-
Name: ID:
abcde 1
efghia 3
pofjsa 5
asklda 6
I want to sort the tables according to increasing ID.
Like this-
Name: ID:
abcde 1
efghia 2
pofjsa 3
asklda 4
Assuming that the ID's are continuously increasing but there are some ID's missing like 11,14,15,16,17,20,21.. etc
ThanksFunny Reviewed by Funny on . SQL Help This is a easy code but I am not able to figure it as Im fairly new to SQL. Example I have a table like this- Name: ID: abcde 1 efghia 3 pofjsa 5 asklda 6 I want to sort the tables according to increasing ID. Rating: 5
-
7th Feb 2012, 03:24 PM #2Respected MemberWebsite's:
DL4Everything.com Soft2050.inSimply use ORDER BY column_name here in your sql query
Example:
PHP Code:SELECT * FROM mysecrettable ORDER BY names
-
7th Feb 2012, 03:28 PM #3Respected DeveloperWebsite's:
wrzc.orgJust to add to the above you can have ORDER BY something DESC or ORDER BY something ASC
which means you can have it decreasing (DESC) or ascending (ASC)Tutorial How to SEO your Warez Site a guide to help you increase your organic traffic
Huge list of Warez Sites and free Multiposter Templates
-
7th Feb 2012, 03:46 PM #4Respected Member
I believe soft meant to say :
PHP Code:SELECT * FROM mysecrettable ORDER BY id asc
-
7th Feb 2012, 04:01 PM #5Respected MemberWebsite's:
DL4Everything.com Soft2050.innah
That would make it from ascending order of the id of the column
Specifying the name of the field would result in the data output in acending order of the column.
http://php.about.com/od/learnmysql/p/SQL_order_by.htm
-
7th Feb 2012, 05:50 PM #6Respected Member
And I guess you can use this link http://php.about.com/od/learnmysql/p/SQL_order_by.htm and one for reading http://www.rif.org/
-
8th Feb 2012, 02:12 PM #7OPMemberWebsite's:
FunLinkz.com Smyu.inThank you for the help guys.
-
9th Feb 2012, 02:25 PM #8OPMemberWebsite's:
FunLinkz.com Smyu.inNow I have another question-
I want to update a column in my sql but I think I got the syntax wrong-
UPDATE `url` SET `destination`="http://"+`destination` WHERE `destination` NOT LIKE 'http%'
-
9th Feb 2012, 05:01 PM #9MemberWebsite's:
sborg.usUse || for concatenating strings
UPDATE `url` SET `destination`='http://'||`destination` WHERE `destination` NOT LIKE 'http%'
V3g3ta | Halcyon | Abhi
-
9th Feb 2012, 05:21 PM #10Respected Member
You are welcome and for the update..
try this one:
PHP Code:UPDATE `url` SET `destination`=concat("http://",`destination`) WHERE `destination` NOT LIKE 'http%'
so it could be simply:
PHP Code:UPDATE url SET destination=concat("http://",destination) WHERE destination NOT LIKE 'http%'
when you use || it means or not concat...
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
themaCreator - create posts from...
Version 3.51 released. Open older version (or...