SQL Query Urgent Doubt please   Independent houses near kukatpally | Apartments in Pragathi Nagar | AndhraVaani.com | Log Out | Topics | Search
Register | Edit Profile

Bewarse TalkStudents, Jobs, Visa Issues & Info � SQL Query Urgent Doubt please Previous Next

Author Message
Top of pagePrevious messageNext messageBottom of pageLink to this message

Idiot
Bewarse Legend
Username: Idiot

Post Number: 24671
Registered: 09-2004
Posted From: 199.245.32.11

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:42 pm:Insert Quote Edit PostDelete PostView Post/Check IP

Top of pagePrevious messageNext messageBottom of pageLink to this message

Infinity
Yavvanam Kaatesina Bewarse
Username: Infinity

Post Number: 1224
Registered: 04-2005
Posted From: 192.127.94.7

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:40 pm:Insert Quote Edit PostDelete PostView Post/Check IP

fine. :-) it is similar ANSI SQL function to evaluate an expression to NULL value.
Top of pagePrevious messageNext messageBottom of pageLink to this message

Idiot
Bewarse Legend
Username: Idiot

Post Number: 24669
Registered: 09-2004
Posted From: 199.245.32.11

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:39 pm:Insert Quote Edit PostDelete PostView Post/Check IP

Top of pagePrevious messageNext messageBottom of pageLink to this message

Honeymist
Yavvanam Kaatesina Bewarse
Username: Honeymist

Post Number: 2134
Registered: 04-2004
Posted From: 66.237.36.130

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:36 pm:Insert Quote Edit PostDelete PostView Post/Check IP

>>COLLEASE

naaku idea ledandi. asalu unnatte teliyadu. I doubt.
Top of pagePrevious messageNext messageBottom of pageLink to this message

Infinity
Yavvanam Kaatesina Bewarse
Username: Infinity

Post Number: 1223
Registered: 04-2005
Posted From: 192.127.94.7

Rating:
Votes: 1(Vote!)

Posted on Wednesday, June 22, 2005 - 5:34 pm:Insert Quote Edit PostDelete PostView Post/Check IP

tumpara one question.. is MS SQL server has a function called COLLEASE?
Top of pagePrevious messageNext messageBottom of pageLink to this message

Honeymist
Yavvanam Kaatesina Bewarse
Username: Honeymist

Post Number: 2133
Registered: 04-2004
Posted From: 66.237.36.130

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:31 pm:Insert Quote Edit PostDelete PostView Post/Check IP

Sinna garu, I tested this query in SQLServer, it worked. Let me know if it worked for you in Oracle.
Top of pagePrevious messageNext messageBottom of pageLink to this message

Honeymist
Yavvanam Kaatesina Bewarse
Username: Honeymist

Post Number: 2132
Registered: 04-2004
Posted From: 66.237.36.130

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:29 pm:Insert Quote Edit PostDelete PostView Post/Check IP

SELECT C_Id=
CASE id
WHEN ' ' THEN 'NULL'
ELSE id
END
FROM table
ORDER BY id desc

Hopefully this should work :-) [in case you did not get it yet]
Top of pagePrevious messageNext messageBottom of pageLink to this message

Infinity
Yavvanam Kaatesina Bewarse
Username: Infinity

Post Number: 1221
Registered: 04-2005
Posted From: 192.127.94.7

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:29 pm:Insert Quote Edit PostDelete PostView Post/Check IP

select CASE when col1 = ' ' then null ELSE col1 end from table1 order by col1 DESC.

Mama adi total CASE expression syntax mama supported by our DBMS. i dont know whether Oracle supports or not. It is a normal syntax that works inline with SQL commands.


CASE WHEN col1 = ' ' THEN null
ELSE col1
END


Caps lo vundedhi syntax..

Also you can that expression as a column something like

CASE WHEN col1 = ' ' THEN null
ELSE col1
END computed_value
Top of pagePrevious messageNext messageBottom of pageLink to this message

Sinna
Mudiripoyina Bewarse
Username: Sinna

Post Number: 5174
Registered: 04-2005
Posted From: 130.70.130.244

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:19 pm:Insert Quote Edit PostDelete PostView Post/Check IP

ante

select CASE when col1 = ' ' then null ELSE col1 end from table1 order by col1 DESC.

itlana Infinity mama..
end ane word enti akkada???
Top of pagePrevious messageNext messageBottom of pageLink to this message

Infinity
Yavvanam Kaatesina Bewarse
Username: Infinity

Post Number: 1220
Registered: 04-2005
Posted From: 192.127.94.7

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:16 pm:Insert Quote Edit PostDelete PostView Post/Check IP

emanna confuse chesi unte sorry...
Kani blank space unna values first vasthunnayyi naku kooda ade ardham katalla


you need to use a CASE expression or similar kind of function first and then do an order BY to get the desired answer set.

it is something like

sel CASE when a = ' ' then null ELSE a end from t1 order by 1 DESC.

it will result in desired result.
Top of pagePrevious messageNext messageBottom of pageLink to this message

Sinna
Mudiripoyina Bewarse
Username: Sinna

Post Number: 5173
Registered: 04-2005
Posted From: 130.70.130.244

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:15 pm:Insert Quote Edit PostDelete PostView Post/Check IP

Thanks for all ur help...
Top of pagePrevious messageNext messageBottom of pageLink to this message

Sinna
Mudiripoyina Bewarse
Username: Sinna

Post Number: 5172
Registered: 04-2005
Posted From: 130.70.130.244

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:14 pm:Insert Quote Edit PostDelete PostView Post/Check IP

oh ok aithe there is no other way na honeymist garu...
Top of pagePrevious messageNext messageBottom of pageLink to this message

Honeymist
Yavvanam Kaatesina Bewarse
Username: Honeymist

Post Number: 2131
Registered: 04-2004
Posted From: 66.237.36.130

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:13 pm:Insert Quote Edit PostDelete PostView Post/Check IP

>>Kani blank space unna values first vasthunnayyi naku kooda ade ardham katalla

As I already mentioned, in your data blankspace is the highest of all [32], so obviously it forms the first in the list
Top of pagePrevious messageNext messageBottom of pageLink to this message

Idiot
Bewarse Legend
Username: Idiot

Post Number: 24658
Registered: 09-2004
Posted From: 199.245.32.11

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:12 pm:Insert Quote Edit PostDelete PostView Post/Check IP

ikkada antha katthulu unnaru kada sql lo
Top of pagePrevious messageNext messageBottom of pageLink to this message

Honeymist
Yavvanam Kaatesina Bewarse
Username: Honeymist

Post Number: 2130
Registered: 04-2004
Posted From: 66.237.36.130

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:12 pm:Insert Quote Edit PostDelete PostView Post/Check IP

sorry read it as 'ascii wise highest' in my previous post
Top of pagePrevious messageNext messageBottom of pageLink to this message

Infinity
Yavvanam Kaatesina Bewarse
Username: Infinity

Post Number: 1219
Registered: 04-2005
Posted From: 192.127.94.7

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:11 pm:Insert Quote Edit PostDelete PostView Post/Check IP

Oh HoneyMist garu its a BLANK SPACE....NOT a NULL

nee yenks... null is different from ASCII SPACE 32
Top of pagePrevious messageNext messageBottom of pageLink to this message

Sinna
Mudiripoyina Bewarse
Username: Sinna

Post Number: 5171
Registered: 04-2005
Posted From: 130.70.130.244

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:10 pm:Insert Quote Edit PostDelete PostView Post/Check IP

emanna confuse chesi unte sorry...
Kani blank space unna values first vasthunnayyi naku kooda ade ardham katalla
Top of pagePrevious messageNext messageBottom of pageLink to this message

Infinity
Yavvanam Kaatesina Bewarse
Username: Infinity

Post Number: 1218
Registered: 04-2005
Posted From: 192.127.94.7

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:10 pm:Insert Quote Edit PostDelete PostView Post/Check IP

Emo mama mari Jsp lo after executing the query vache results lo mathram first NULL values anni vachi tharuvatha emanna value unnavi aithe Descending lo correct gane vasthunnayyi...

If thats the case the ODBC/JDBC driver settings must be tuned to get correct result set back in the same order if it tampered the result set. Mostly no intermediate driver should change the result set order. Except some setting to mask Null rows is set for that DSN.

pls check with other SQL clients like CLI or any native support clients of that RDBMS. if you get correct result over there.. then fix ur ODBC/JDBC driver.
Top of pagePrevious messageNext messageBottom of pageLink to this message

Honeymist
Yavvanam Kaatesina Bewarse
Username: Honeymist

Post Number: 2129
Registered: 04-2004
Posted From: 66.237.36.130

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:09 pm:Insert Quote Edit PostDelete PostView Post/Check IP

>>HoneyMist garu its a BLANK SPACE

mari obviously blank space is ascii wise least avutundi kada? you confused us :-)
Top of pagePrevious messageNext messageBottom of pageLink to this message

Sinna
Mudiripoyina Bewarse
Username: Sinna

Post Number: 5170
Registered: 04-2005
Posted From: 130.70.130.244

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:07 pm:Insert Quote Edit PostDelete PostView Post/Check IP

OB mayya nee pani taruvatah ceptha undu ehe assale ikkada picha tension ga unte
Top of pagePrevious messageNext messageBottom of pageLink to this message

Sinna
Mudiripoyina Bewarse
Username: Sinna

Post Number: 5169
Registered: 04-2005
Posted From: 130.70.130.244

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:07 pm:Insert Quote Edit PostDelete PostView Post/Check IP

Oh HoneyMist garu its a BLANK SPACE....NOT a NULL
Top of pagePrevious messageNext messageBottom of pageLink to this message

Onlybooth
Yavvanam Kaatesina Bewarse
Username: Onlybooth

Post Number: 1089
Registered: 06-2004
Posted From: 216.59.202.161

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:06 pm:Insert Quote Edit PostDelete PostView Post/Check IP

mar mama ani adugu mama

NN collection ni null chesinatu neeku correct query cehpthaadu
Top of pagePrevious messageNext messageBottom of pageLink to this message

Honeymist
Yavvanam Kaatesina Bewarse
Username: Honeymist

Post Number: 2128
Registered: 04-2004
Posted From: 66.237.36.130

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:06 pm:Insert Quote Edit PostDelete PostView Post/Check IP

Also, you mentioned NUL(BLANK SPACE) - is it NULL value or blank space?
Top of pagePrevious messageNext messageBottom of pageLink to this message

Sinna
Mudiripoyina Bewarse
Username: Sinna

Post Number: 5168
Registered: 04-2005
Posted From: 130.70.130.244

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:06 pm:Insert Quote Edit PostDelete PostView Post/Check IP

Oracle 10G
Top of pagePrevious messageNext messageBottom of pageLink to this message

Sinna
Mudiripoyina Bewarse
Username: Sinna

Post Number: 5167
Registered: 04-2005
Posted From: 130.70.130.244

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:06 pm:Insert Quote Edit PostDelete PostView Post/Check IP

Emo mama mari Jsp lo after executing the query vache results lo mathram first NULL values anni vachi tharuvatha emanna value unnavi aithe Descending lo correct gane vasthunnayyi...
Top of pagePrevious messageNext messageBottom of pageLink to this message

Infinity
Yavvanam Kaatesina Bewarse
Username: Infinity

Post Number: 1217
Registered: 04-2005
Posted From: 192.127.94.7

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:05 pm:Insert Quote Edit PostDelete PostView Post/Check IP

Atla ravatledu mama NULL values paina vasthunnayyi taruvatha Desc order lo vasthunnayyi

nuvvu vaadey RDBMS enti mama? idi bug software lo.
Top of pagePrevious messageNext messageBottom of pageLink to this message

Honeymist
Yavvanam Kaatesina Bewarse
Username: Honeymist

Post Number: 2127
Registered: 04-2004
Posted From: 66.237.36.130

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:05 pm:Insert Quote Edit PostDelete PostView Post/Check IP

Which database are you using?
Top of pagePrevious messageNext messageBottom of pageLink to this message

Infinity
Yavvanam Kaatesina Bewarse
Username: Infinity

Post Number: 1216
Registered: 04-2005
Posted From: 192.127.94.7

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:04 pm:Insert Quote Edit PostDelete PostView Post/Check IP

NUll last lo raavali mama..

i tried and it worked in my RDBMS.

Here is the result:


sel a from tx order by 1 desc ;

*** Query completed. 4 rows found. One column returned.
*** Total elapsed time was 1 second.

a
-----------
10
1
0
?
Top of pagePrevious messageNext messageBottom of pageLink to this message

Honeymist
Yavvanam Kaatesina Bewarse
Username: Honeymist

Post Number: 2126
Registered: 04-2004
Posted From: 66.237.36.130

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:04 pm:Insert Quote Edit PostDelete PostView Post/Check IP

select value_id from table order by value_id desc
Top of pagePrevious messageNext messageBottom of pageLink to this message

Infinity
Yavvanam Kaatesina Bewarse
Username: Infinity

Post Number: 1215
Registered: 04-2005
Posted From: 192.127.94.7

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:01 pm:Insert Quote Edit PostDelete PostView Post/Check IP

typo "ORDER BY column_name DESC"
Top of pagePrevious messageNext messageBottom of pageLink to this message

Sinna
Mudiripoyina Bewarse
Username: Sinna

Post Number: 5166
Registered: 04-2005
Posted From: 130.70.130.244

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:01 pm:Insert Quote Edit PostDelete PostView Post/Check IP

Atla ravatledu mama NULL values paina vasthunnayyi taruvatha Desc order lo vasthunnayyi
Top of pagePrevious messageNext messageBottom of pageLink to this message

Infinity
Yavvanam Kaatesina Bewarse
Username: Infinity

Post Number: 1214
Registered: 04-2005
Posted From: 192.127.94.7

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 5:00 pm:Insert Quote Edit PostDelete PostView Post/Check IP

order column_name DESC ani ivvu mama.
Top of pagePrevious messageNext messageBottom of pageLink to this message

Sinna
Mudiripoyina Bewarse
Username: Sinna

Post Number: 5165
Registered: 04-2005
Posted From: 130.70.130.244

Rating:N/A
Votes: 0(Vote!)

Posted on Wednesday, June 22, 2005 - 4:57 pm:Insert Quote Edit PostDelete PostView Post/Check IP

Oka table lo unna values annitini Desecnding order by a column print cheyyali..
Konni values Null unte aa column lo ayyi last lo ravali that is NULL veru 0 value for that column veru ante
10
9
6
5
4
1
0
NUL(BLANK SPACE)

Idi etla Order cheyyali