loveindia Posted February 4, 2013 Report Posted February 4, 2013 [quote name='Kaarthikeya' timestamp='1359989629' post='1303222103'] Bhayya nuvvu cheppina query chesthe motham table lo ne unna max vastundemo kadaa I want the max date for each id [/quote] Babu karthikeya... nenu ichina query each id ki max date ni teeskostundi kada.. inka enti problem.. test chesi mari ichanu kada vay... what is wrong.. nenu chesina tappu emiti.. I demand an explanation u know..
deals2buy Posted February 4, 2013 Report Posted February 4, 2013 [quote name='loveindia' timestamp='1359992041' post='1303222400'] Babu karthikeya... nenu ichina query each id ki max date ni teeskostundi kada.. inka enti problem.. test chesi mari ichanu kada vay... what is wrong.. nenu chesina tappu emiti.. I demand an explanation u know.. [/quote] Duplicate aithunnayi bhayya....City veru undatam valla two rows return avutunnayi instead of one row My situation is something like this ID City Start_date End_Date 101 Chicago 2011-01-01 2011-12-31 101 New York 2010-10-31 2011-01-01 Ila unnappudu nuvvu cheppina query chesthe rendu records vastunnayi...kaani okkate raavali
loveindia Posted February 4, 2013 Report Posted February 4, 2013 [quote name='Kaarthikeya' timestamp='1359992168' post='1303222415'] Duplicate aithunnayi bhayya....City veru undatam valla two rows return avutunnayi instead of one row My situation is something like this ID City Start_date End_Date 101 Chicago 2011-01-01 2011-12-31 101 New York 2010-10-31 2011-01-01 Ila unnappudu nuvvu cheppina query chesthe rendu records vastunnayi...kaani okkate raavali [/quote] city and state tho kuda join cheyyi saripotundi kada.. then you will get only one value... ala try cheyledaa bedaruuu...
deals2buy Posted February 4, 2013 Report Posted February 4, 2013 [quote name='loveindia' timestamp='1360010606' post='1303224843'] city and state tho kuda join cheyyi saripotundi kada.. then you will get only one value... ala try cheyledaa bedaruuu... [/quote] ala try chesthe duplicates povadam poyi unna records kuda raavatam ledu
ChampakDas Posted February 4, 2013 Report Posted February 4, 2013 Edit: I thought kaarthikeya mitram had problem
ChampakDas Posted February 4, 2013 Report Posted February 4, 2013 ee butterfly effect ento...deni gurinchey vedham anukunna ee db lo yavariki ina useful avutundhi ani...Redgate ani kotha tool it compares two given tables from two different servers then generates script to upgrade the the previous to new...this will help aa tool needagira undho ledho no idea query laga antey sinmple ga join lo neeku kavalsina columns compare chesi petachu kada what is issue in that.. [quote name='reddy001' timestamp='1359990150' post='1303222145'] Folks, I have two tables with same structure, need to compare the data between two tables, please share any query for that. Thanks, [/quote]
mtkr Posted February 5, 2013 Report Posted February 5, 2013 [quote name='Kaarthikeya' timestamp='1359989629' post='1303222103'] Bhayya nuvvu cheppina query chesthe motham table lo ne unna max vastundemo kadaa I want the max date for each id [/quote] no.... group by id chestunnam kabatti only set of rec( set of id ) ke vostaiiii.....
mtkr Posted February 5, 2013 Report Posted February 5, 2013 [quote name='Kaarthikeya' timestamp='1359992168' post='1303222415'] Duplicate aithunnayi bhayya....City veru undatam valla two rows return avutunnayi instead of one row My situation is something like this ID City Start_date End_Date 101 Chicago 2011-01-01 2011-12-31 101 New York 2010-10-31 2011-01-01 Ila unnappudu nuvvu cheppina query chesthe rendu records vastunnayi...kaani okkate raavali [/quote] ne NY end date ni change chesa..... for better understanding.... [CODE] create table #table2 ( id int, city varchar(10), start_date varchar(30), end_date varchar(30) ) [/CODE] [CODE] insert into #table2 values ( 101,'Chicago','2011-01-01','2011-12-31') insert into #table2 values ( 101,'New York','2010-10-31','2012-01-01') [/CODE] [CODE] SELECT ID, city, start_date, end_date FROM #table2 WHERE start_date IN (SELECT MAX(start_date)FROM #table2 GROUP BY id) [/CODE] result:: [CODE] id city start_date end date 101 Chicago 2011-01-01 2011-12-31 [/CODE] [CODE] SELECT ID, city, start_date, end_date FROM #table2 WHERE end_date IN (SELECT MAX(end_date)FROM #table2 GROUP BY id) [/CODE] result:: [CODE] id city start_date end date 101 New York 2010-10-31 2012-01-01 [/CODE]
deals2buy Posted February 5, 2013 Report Posted February 5, 2013 MTKR mama nuvvu malli ade query raastunnav...nuvvu raase query motham table lo unna max date ni pull chestundi kadaa? each record ki max date diff ga untundi....nenu ee type query raasanu kaani naaku work out avvale...may be nenu inko Table kuda join chestunna apart from the above two tables..anduke diff vastundemo...I could solve the issue today...But its taking nearly 2 mins to run for the View....daanni ela tune cheyyalo ardham kaavatledu anyways for actively giving me reply
ghazni Posted February 5, 2013 Report Posted February 5, 2013 [quote name='Kaarthikeya' timestamp='1360030825' post='1303226520'] MTKR mama nuvvu malli ade query raastunnav...nuvvu raase query motham table lo unna max date ni pull chestundi kadaa? each record ki max date diff ga untundi....nenu ee type query raasanu kaani naaku work out avvale...may be nenu inko Table kuda join chestunna apart from the above two tables..anduke diff vastundemo...I could solve the issue today...But its taking nearly 2 mins to run for the View....daanni ela tune cheyyalo ardham kaavatledu anyways for actively giving me reply [/quote] naku ni situation motham teliyadu kani row number and rank try chesava...........
deals2buy Posted February 5, 2013 Report Posted February 5, 2013 [quote name='ghazni' timestamp='1360030910' post='1303226524'] naku ni situation motham teliyadu kani row number and rank try chesava........... [/quote] Legacy DWH Tool lo avi levu ga
ghazni Posted February 5, 2013 Report Posted February 5, 2013 [quote name='Kaarthikeya' timestamp='1360030988' post='1303226527'] Legacy DWH Tool lo avi levu ga [/quote] ne scenario a page lo undi........
deals2buy Posted February 5, 2013 Report Posted February 5, 2013 [quote name='ghazni' timestamp='1360031079' post='1303226533'] ne scenario a page lo undi........ [/quote] http://www.andhrafriends.com/topic/343735-ms-sql-server-technology-discussions/page__st__870#entry1303195781
ghazni Posted February 5, 2013 Report Posted February 5, 2013 [quote name='Kaarthikeya' timestamp='1360031183' post='1303226536'] [url="http://www.andhrafriends.com/topic/343735-ms-sql-server-technology-discussions/page__st__870#entry1303195781"]http://www.andhrafri...entry1303195781[/url] [/quote] max enddate peti group by only id petu.......
loveindia Posted February 5, 2013 Report Posted February 5, 2013 [quote name='Kaarthikeya' timestamp='1360030825' post='1303226520'] MTKR mama nuvvu malli ade query raastunnav...nuvvu raase query motham table lo unna max date ni pull chestundi kadaa? each record ki max date diff ga untundi....nenu ee type query raasanu kaani naaku work out avvale...may be nenu inko Table kuda join chestunna apart from the above two tables..anduke diff vastundemo...I could solve the issue today...But its taking nearly 2 mins to run for the View....daanni ela tune cheyyalo ardham kaavatledu anyways for actively giving me reply [/quote] orey ayya... max(date) group by id ani raasadu kada.. adi raastey every id ki max date edi undo danni pick chestadi.. nuvvu query lo adi miss avutu undi untaav.. baaga chudu..
Recommended Posts