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

Bewarse TalkArchives - 2007Cine Talk - Reviews, Gossips, Insider Info etc.Archive through April 16, 2007SQL Help Previous Next

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

Nayakudu
Desanike Pedda Bewarse
Username: Nayakudu

Post Number: 7408
Registered: 05-2005
Posted From: 129.188.69.129

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

Posted on Friday, April 13, 2007 - 2:02 pm:Edit PostDelete PostView Post/Check IP

cool buddy ante mana daggarike
Top of pagePrevious messageNext messageBottom of pageLink to this message

Nks
Pilla Bewarse
Username: Nks

Post Number: 97
Registered: 08-2004
Posted From: 38.101.49.150

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

Posted on Friday, April 13, 2007 - 1:57 pm:Edit PostDelete PostView Post/Check IP

maa manager ku query isthe ippudu vadhule DWH team choosukuntundhi manaku sambandham ledhu annadu
Top of pagePrevious messageNext messageBottom of pageLink to this message

Nayakudu
Desanike Pedda Bewarse
Username: Nayakudu

Post Number: 7407
Registered: 05-2005
Posted From: 129.188.69.129

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

Posted on Friday, April 13, 2007 - 1:55 pm:Edit PostDelete PostView Post/Check IP

Tmbuff mama he is using SQL server so those row_num() may not be available in SQL server
Top of pagePrevious messageNext messageBottom of pageLink to this message

Tmbuff
Pilla Bewarse
Username: Tmbuff

Post Number: 162
Registered: 04-2004
Posted From: 159.153.4.51

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

Posted on Friday, April 13, 2007 - 1:52 pm:Edit PostDelete PostView Post/Check IP

Nks -

User the query I provided. It should give you good performance if the volume of the table is high.
Top of pagePrevious messageNext messageBottom of pageLink to this message

Nayakudu
Desanike Pedda Bewarse
Username: Nayakudu

Post Number: 7401
Registered: 05-2005
Posted From: 136.182.158.129

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

Posted on Friday, April 13, 2007 - 12:33 pm:Edit PostDelete PostView Post/Check IP

nenu ichhinadi work cheyyatam ledaa
Top of pagePrevious messageNext messageBottom of pageLink to this message

Proofdada
Bewarse ke Bewarse!
Username: Proofdada

Post Number: 53936
Registered: 03-2004
Posted From: 80.121.144.9

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

Posted on Friday, April 13, 2007 - 8:56 am:Edit PostDelete PostView Post/Check IP

nenu complex stmt lu yeppudu use seyyaleedhu...anni arrays looki read seeseukuni sorting sesukuntaa..
nannnu aaapadddu....
Top of pagePrevious messageNext messageBottom of pageLink to this message

Nks
Pilla Bewarse
Username: Nks

Post Number: 96
Registered: 08-2004
Posted From: 38.101.49.150

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

Posted on Friday, April 13, 2007 - 8:53 am:Edit PostDelete PostView Post/Check IP

thanks mamalu

vamsam_fan ichina query work iyindhi.
andhariki chala chala thanks.
Top of pagePrevious messageNext messageBottom of pageLink to this message

Gaali
Bewarse ke Bewarse!
Username: Gaali

Post Number: 12151
Registered: 03-2004
Posted From: 71.128.217.70

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

Posted on Thursday, April 12, 2007 - 11:49 pm:Edit PostDelete PostView Post/Check IP

16th midnight kalla tax returns file cheyyali mama. Vaati meda kusthee paduthunna. Madhyalo break teesukonna.
Top of pagePrevious messageNext messageBottom of pageLink to this message

Netman
Pilla Bewarse
Username: Netman

Post Number: 122
Registered: 03-2004
Posted From: 59.93.112.5

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

Posted on Thursday, April 12, 2007 - 11:48 pm:Edit PostDelete PostView Post/Check IP

అల్లుడూ

అంత పరాచికాలు వద్దులే! ఏమిటీ సంగతులు? ఇంకా నిదుర టైం అవ్వలేదా?
Top of pagePrevious messageNext messageBottom of pageLink to this message

Gaali
Bewarse ke Bewarse!
Username: Gaali

Post Number: 12146
Registered: 03-2004
Posted From: 71.128.217.70

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

Posted on Thursday, April 12, 2007 - 11:42 pm:Edit PostDelete PostView Post/Check IP

Netman mama

Meeru Bezawada lo SQL coaching center open cheyyandi.
Top of pagePrevious messageNext messageBottom of pageLink to this message

Andhramass
Bewarse ke Bewarse!
Username: Andhramass

Post Number: 14984
Registered: 07-2006
Posted From: 203.26.122.12

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

Posted on Thursday, April 12, 2007 - 11:36 pm:Edit PostDelete PostView Post/Check IP

okk nenu wrong sequence lo open chesannu

i will try today
మాస్ అంటే ఇష్టం, బెజవాడ అంటే ప్రాణం
Top of pagePrevious messageNext messageBottom of pageLink to this message

Andhramass
Bewarse ke Bewarse!
Username: Andhramass

Post Number: 14983
Registered: 07-2006
Posted From: 203.26.122.12

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

Posted on Thursday, April 12, 2007 - 11:36 pm:Edit PostDelete PostView Post/Check IP

AM
Are you in Vijayawada? I am now in Vijayawada.


ledhu aus lo vunnaaaa?

holidays ki vacharaaaa?
మాస్ అంటే ఇష్టం, బెజవాడ అంటే ప్రాణం
Top of pagePrevious messageNext messageBottom of pageLink to this message

Netman
Pilla Bewarse
Username: Netman

Post Number: 121
Registered: 03-2004
Posted From: 59.93.112.5

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

Posted on Thursday, April 12, 2007 - 11:28 pm:Edit PostDelete PostView Post/Check IP

AM
Are you in Vijayawada? I am now in Vijayawada.

You have to start IM window with one of your online contacts in Yahoo Messenger8.1 or GoogleTalk. Then you shouldopen my my application and start typing in that. For sending you need to hit 'enter' in my application itself.
Top of pagePrevious messageNext messageBottom of pageLink to this message

Andhramass
Bewarse ke Bewarse!
Username: Andhramass

Post Number: 14978
Registered: 07-2006
Posted From: 203.26.122.12

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

Posted on Thursday, April 12, 2007 - 11:21 pm:Edit PostDelete PostView Post/Check IP

netmama

merru chepina software instal chessaa

after that gtalk or YM open chesiii

mee tool lo telugu type chesi enter anni clik chesthey ravatham ledhu

yenduku?
మాస్ అంటే ఇష్టం, బెజవాడ అంటే ప్రాణం
Top of pagePrevious messageNext messageBottom of pageLink to this message

Netman
Pilla Bewarse
Username: Netman

Post Number: 119
Registered: 03-2004
Posted From: 59.93.112.5

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

Posted on Thursday, April 12, 2007 - 11:15 pm:Edit PostDelete PostView Post/Check IP

NKS

Assuming, TEMP is table name and INo is auto-increasing value, find the Maximum of INO with

Select max(Ino) from Temp

Then Select the ClassID of the Maximum INo, since this is not a fixed one and may be 5, 6, 7.. like that.

Select Ino as MxIno, ClassID as MxClassID from Temp where Ino= (
Select max(Ino) from Temp)

So, now select all records whose INO is (Maximum Ino- Maximum ClassID)

Final Query is:

SELECT Temp.*
FROM Temp, [select Ino as MxIno, ClassID as Mxclassid from Temp where INO= (SELECT max(Ino)
FROM temp)]. AS Mxtemp
WHERE Ino> MxIno-Mxclassid;

This is Access SQL syntax. I am not sure about SQL2000 syntax for 'Max' function. Use help and see whether this hold good.
Top of pagePrevious messageNext messageBottom of pageLink to this message

Nks
Pilla Bewarse
Username: Nks

Post Number: 95
Registered: 08-2004
Posted From: 68.38.177.133

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

Posted on Thursday, April 12, 2007 - 6:45 pm:Edit PostDelete PostView Post/Check IP

oops sorry mamalu

nenu SQL Server 2000 lo try chesthunna
andhulo error vasthondhi. repu morning officec ku vellaka mari try chestha.

andhariki chala thanks :-)
Top of pagePrevious messageNext messageBottom of pageLink to this message

Vamsam_fan
Pilla Bewarse
Username: Vamsam_fan

Post Number: 52
Registered: 02-2006
Posted From: 65.121.89.2

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

Posted on Thursday, April 12, 2007 - 6:09 pm:Edit PostDelete PostView Post/Check IP

drop table t1;

create table t1
(
ino integer,
polID integer,
classid integer,
value integer);

insert into t1 values(1, 100, 1, 10);
insert into t1 values(2, 100, 2, 3 );
insert into t1 values(3 ,100, 3 ,1 );
insert into t1 values(4, 100, 4 ,4 );
insert into t1 values(5, 100, 5 ,3 );
insert into t1 values(6, 100, 1 ,34 );
insert into t1 values(7, 100, 2 ,32 );
insert into t1 values(8, 100, 3 ,43 );
insert into t1 values(9, 100, 4 ,8 );
insert into t1 values(10, 100, 5 ,10 );
insert into t1 values(11, 100, 1 ,1 );
insert into t1 values(12, 100, 2 ,5 );
insert into t1 values(13, 100, 3 ,8 );
insert into t1 values(14, 100, 4 ,5 );
insert into t1 values(15, 100, 5, 9 );


commit;

select * from t1
where ino in
(
select max(ino) as ino
from t1
group by classid
)
Top of pagePrevious messageNext messageBottom of pageLink to this message

Tmbuff
Pilla Bewarse
Username: Tmbuff

Post Number: 161
Registered: 04-2004
Posted From: 159.153.4.51

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

Posted on Thursday, April 12, 2007 - 4:31 pm:Edit PostDelete PostView Post/Check IP

You can use this --
SELECT * FROM (SELECT INO, PolID, ClassID, Value, ROW_NUMBER() OVER (PARTITION BY CLASSID ORDER BY INO DESC) RN
FROM TABLE)
WHERE RN =1
Top of pagePrevious messageNext messageBottom of pageLink to this message

Beer
Vooriki Bewarse
Username: Beer

Post Number: 2906
Registered: 09-2006
Posted From: 208.204.155.241

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

Posted on Thursday, April 12, 2007 - 4:08 pm:Edit PostDelete PostView Post/Check IP

work avutundi... naku kooda no problem.. oracle version 9i..
Okkadunnadu
Top of pagePrevious messageNext messageBottom of pageLink to this message

Nayakudu
Desanike Pedda Bewarse
Username: Nayakudu

Post Number: 7368
Registered: 05-2005
Posted From: 136.182.158.145

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

Posted on Thursday, April 12, 2007 - 4:06 pm:Edit PostDelete PostView Post/Check IP

yemo naku work avuthundi
Top of pagePrevious messageNext messageBottom of pageLink to this message

Nayakudu
Desanike Pedda Bewarse
Username: Nayakudu

Post Number: 7367
Registered: 05-2005
Posted From: 136.182.158.145

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

Posted on Thursday, April 12, 2007 - 4:06 pm:Edit PostDelete PostView Post/Check IP

enduku vasthundi rakudadu kada
Top of pagePrevious messageNext messageBottom of pageLink to this message

Beer
Vooriki Bewarse
Username: Beer

Post Number: 2905
Registered: 09-2006
Posted From: 208.204.155.241

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

Posted on Thursday, April 12, 2007 - 4:06 pm:Edit PostDelete PostView Post/Check IP

enduku dorlings
Okkadunnadu
Top of pagePrevious messageNext messageBottom of pageLink to this message

Nayakudu
Desanike Pedda Bewarse
Username: Nayakudu

Post Number: 7366
Registered: 05-2005
Posted From: 136.182.158.145

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

Posted on Thursday, April 12, 2007 - 4:03 pm:Edit PostDelete PostView Post/Check IP

Top of pagePrevious messageNext messageBottom of pageLink to this message

Nks
Pilla Bewarse
Username: Nks

Post Number: 94
Registered: 08-2004
Posted From: 38.101.49.150

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

Posted on Thursday, April 12, 2007 - 3:59 pm:Edit PostDelete PostView Post/Check IP

nayakudu mama

iam getting this error when i run ur query

The ORDER BY clause is invalid in views, inline functions, derived tables, and subqueries, unless TOP is also specified.
Top of pagePrevious messageNext messageBottom of pageLink to this message

Nayakudu
Desanike Pedda Bewarse
Username: Nayakudu

Post Number: 7360
Registered: 05-2005
Posted From: 136.182.158.145

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

Posted on Thursday, April 12, 2007 - 3:53 pm:Edit PostDelete PostView Post/Check IP

no no previous one is the correct one with slight modification

select * from
(select * from table order by IdNo desc, order num asc, classID asc) tmp
where tmp.rownum < (select count(distinct classid) from table where order_no = tmp.order_no)
this should work if i am right
Top of pagePrevious messageNext messageBottom of pageLink to this message

Nayakudu
Desanike Pedda Bewarse
Username: Nayakudu

Post Number: 7359
Registered: 05-2005
Posted From: 136.182.158.145

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

Posted on Thursday, April 12, 2007 - 3:51 pm:Edit PostDelete PostView Post/Check IP

select * from
(select * from table order by IdNo desc, order num asc, classID asc) tmp
where tmp.rownum < (select count(distinct classid) from table where ID_no = tmp.id_no)

this should list the latest ones for each order
Top of pagePrevious messageNext messageBottom of pageLink to this message

Nayakudu
Desanike Pedda Bewarse
Username: Nayakudu

Post Number: 7356
Registered: 05-2005
Posted From: 129.188.69.145

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

Posted on Thursday, April 12, 2007 - 3:41 pm:Edit PostDelete PostView Post/Check IP

ok here is the final query

select * from
(select * from table order by IdNo desc, order num asc, classID asc) tmp, table
where tmp.Idno = table.Idno and
tmp.rownum < (select count(distinct classid) from table where order_no = tmp.order_no)
Top of pagePrevious messageNext messageBottom of pageLink to this message

Beer
Vooriki Bewarse
Username: Beer

Post Number: 2904
Registered: 09-2006
Posted From: 208.204.155.241

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

Posted on Thursday, April 12, 2007 - 3:37 pm:Edit PostDelete PostView Post/Check IP

this will work

select * from (
select * from table order by IDNO desc)
where rownum <= select count(distinct classid) from tab);
Okkadunnadu
Top of pagePrevious messageNext messageBottom of pageLink to this message

Nayakudu
Desanike Pedda Bewarse
Username: Nayakudu

Post Number: 7355
Registered: 05-2005
Posted From: 129.188.69.145

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

Posted on Thursday, April 12, 2007 - 3:36 pm:Edit PostDelete PostView Post/Check IP

evaru vachharu evaru phone chesaru asalu yemiti katha
Top of pagePrevious messageNext messageBottom of pageLink to this message

Nayakudu
Desanike Pedda Bewarse
Username: Nayakudu

Post Number: 7354
Registered: 05-2005
Posted From: 129.188.69.145

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

Posted on Thursday, April 12, 2007 - 3:36 pm:Edit PostDelete PostView Post/Check IP

Top of pagePrevious messageNext messageBottom of pageLink to this message

Rratna
Desanike Pedda Bewarse
Username: Rratna

Post Number: 6031
Registered: 03-2004
Posted From: 69.81.48.27

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

Posted on Thursday, April 12, 2007 - 3:36 pm:Edit PostDelete PostView Post/Check IP

voorloki vachi call chesthe kaneesam phone kooda etha ledu kada Nayakudu mama . Idhi neeku dharmama?
Top of pagePrevious messageNext messageBottom of pageLink to this message

Nayakudu
Desanike Pedda Bewarse
Username: Nayakudu

Post Number: 7353
Registered: 05-2005
Posted From: 129.188.69.145

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

Posted on Thursday, April 12, 2007 - 3:35 pm:Edit PostDelete PostView Post/Check IP

is the number of distinct classID values per each order varies but no is fixed for an order .. correctena
Top of pagePrevious messageNext messageBottom of pageLink to this message

Nayakudu
Desanike Pedda Bewarse
Username: Nayakudu

Post Number: 7352
Registered: 05-2005
Posted From: 129.188.69.145

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

Posted on Thursday, April 12, 2007 - 3:34 pm:Edit PostDelete PostView Post/Check IP

oka order ki these many distinct class IDs ani fixed naa???
Top of pagePrevious messageNext messageBottom of pageLink to this message

Nayakudu
Desanike Pedda Bewarse
Username: Nayakudu

Post Number: 7351
Registered: 05-2005
Posted From: 129.188.69.145

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

Posted on Thursday, April 12, 2007 - 3:33 pm:Edit PostDelete PostView Post/Check IP

so every order lo latest 123456 theyala ????
Top of pagePrevious messageNext messageBottom of pageLink to this message

Nayakudu
Desanike Pedda Bewarse
Username: Nayakudu

Post Number: 7350
Registered: 05-2005
Posted From: 129.188.69.145

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

Posted on Thursday, April 12, 2007 - 3:33 pm:Edit PostDelete PostView Post/Check IP

will there be addition of values to classID down the line
Top of pagePrevious messageNext messageBottom of pageLink to this message

Nks
Pilla Bewarse
Username: Nks

Post Number: 93
Registered: 08-2004
Posted From: 38.101.49.150

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

Posted on Thursday, April 12, 2007 - 3:32 pm:Edit PostDelete PostView Post/Check IP

beer mama alanti scenario levu....

ClassID
1
2
3
4
5
6
.
.
.


ala incremental ga vuntai and adhe order lo repeat avuthai
Top of pagePrevious messageNext messageBottom of pageLink to this message

Nayakudu
Desanike Pedda Bewarse
Username: Nayakudu

Post Number: 7349
Registered: 05-2005
Posted From: 129.188.69.145

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

Posted on Thursday, April 12, 2007 - 3:32 pm:Edit PostDelete PostView Post/Check IP

do you have any time stamp... does class ID always be only one of (1,2,3,4,5)
Top of pagePrevious messageNext messageBottom of pageLink to this message

Nks
Pilla Bewarse
Username: Nks

Post Number: 92
Registered: 08-2004
Posted From: 38.101.49.150

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

Posted on Thursday, April 12, 2007 - 3:31 pm:Edit PostDelete PostView Post/Check IP

hmm row_num < 6 ala hardcoded vundakudadhu.

nenu just example kindha ala icha... there are around 100 rows and may increase
Top of pagePrevious messageNext messageBottom of pageLink to this message

Beer
Vooriki Bewarse
Username: Beer

Post Number: 2903
Registered: 09-2006
Posted From: 208.204.155.241

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

Posted on Thursday, April 12, 2007 - 3:29 pm:Edit PostDelete PostView Post/Check IP

kani this may not work all the time

consider this scenario

1 100 1 10
2 100 2 3
3 100 3 1
4 100 4 4
5 100 5 3
6 100 1 34
7 100 2 32
8 100 3 43
9 100 4 8
10 100 2 5
11 100 1 1
12 100 5 10
13 100 3 8
14 100 4 5
15 100 5 9
Okkadunnadu
Top of pagePrevious messageNext messageBottom of pageLink to this message

Pda
Desanike Pedda Bewarse
Username: Pda

Post Number: 8914
Registered: 06-2006
Posted From: 129.138.18.85

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

Posted on Thursday, April 12, 2007 - 3:28 pm:Edit PostDelete PostView Post/Check IP

naakudu baa

select * from (
select * from table order by INO desc)
where row_num < 6 order by INO ASC

aina tana kochen adi kadu anukunta..
Don't show me your attitude. _|_ have got my own.
Top of pagePrevious messageNext messageBottom of pageLink to this message

Nayakudu
Desanike Pedda Bewarse
Username: Nayakudu

Post Number: 7348
Registered: 05-2005
Posted From: 136.182.158.145

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

Posted on Thursday, April 12, 2007 - 3:27 pm:Edit PostDelete PostView Post/Check IP

kaka pothey data ekkuvunte kastamemo kada.. sorting cheyyalante first...
Top of pagePrevious messageNext messageBottom of pageLink to this message

Beer
Vooriki Bewarse
Username: Beer

Post Number: 2902
Registered: 09-2006
Posted From: 208.204.155.241

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

Posted on Thursday, April 12, 2007 - 3:27 pm:Edit PostDelete PostView Post/Check IP

chinna correction..

select * from (
select * from table order by IDNO desc)
where rownum < 6
Okkadunnadu
Top of pagePrevious messageNext messageBottom of pageLink to this message

Beer
Vooriki Bewarse
Username: Beer

Post Number: 2901
Registered: 09-2006
Posted From: 208.204.155.241

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

Posted on Thursday, April 12, 2007 - 3:26 pm:Edit PostDelete PostView Post/Check IP

katti cheppavu nayak... too good
Okkadunnadu
Top of pagePrevious messageNext messageBottom of pageLink to this message

Nayakudu
Desanike Pedda Bewarse
Username: Nayakudu

Post Number: 7347
Registered: 05-2005
Posted From: 136.182.158.145

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

Posted on Thursday, April 12, 2007 - 3:23 pm:Edit PostDelete PostView Post/Check IP

select * from (
select * from table order by IDNO desc)
where row_num < 6

Top of pagePrevious messageNext messageBottom of pageLink to this message

Nks
Pilla Bewarse
Username: Nks

Post Number: 91
Registered: 08-2004
Posted From: 38.101.49.150

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

Posted on Thursday, April 12, 2007 - 3:14 pm:Edit PostDelete PostView Post/Check IP

naaku SQL lo kastha help cheyandi mamalu.

INO, PolID, ClassID, Value

ivi coloumns. INO anedhi Identity column. PolID anedhi foregin key.

sample data

INO PolID ClassID Value
1 100 1 10
2 100 2 3
3 100 3 1
4 100 4 4
5 100 5 3
6 100 1 34
7 100 2 32
8 100 3 43
9 100 4 8
10 100 5 10
11 100 1 1
12 100 2 5
13 100 3 8
14 100 4 5
15 100 5 9


andhulo class ID distinct values vachi 1,2,3,4,5
avi 3 times same order lo repeat iyyayi.

naaku latest distinct class ID data motham kavali

OUTPUT:
11 100 1 1
12 100 2 5
13 100 3 8
14 100 4 5
15 100 5 9


evarikanna theusthe kastha chepandi annalu