sqlhelp Posted August 21, 2015 Report Posted August 21, 2015 hi sql server lo oka view ni execute chesi ah vachina result view ni malli re execute cheyocha ? like for eg select Data from vwData where viewID = 4 so idi oka view 4 ni execute cheshtundi , dani name vwDB so ee vwDB lo unna results ni execute cheyocha ? ee vwDB anedi often change avthundi untundi so instead of directly executing ila cheyocha? sql kakapoina . net lo aina ?
mtkr Posted August 21, 2015 Report Posted August 21, 2015 Bro... kudirithe try 2 post wth some sample queries n resultsets...
4Vikram Posted August 21, 2015 Report Posted August 21, 2015 calling sql experts... sql deva loveindia ravali ravali
rikki Posted August 21, 2015 Report Posted August 21, 2015 so you want to select some rows from a view and utilize that output later on in the query use CTE
DaleSteyn1 Posted August 21, 2015 Report Posted August 21, 2015 Terminology wrong undhi detailed ga cheppu
mavrick4 Posted August 21, 2015 Report Posted August 21, 2015 Execute view and store the results in cte( common table expression) and donwhtever you want in that new reusult set...
viziotelevision Posted August 21, 2015 Report Posted August 21, 2015 hi sql server lo oka view ni execute chesi ah vachina result view ni malli re execute cheyocha ? like for eg select Data from vwData where viewID = 4 so idi oka view 4 ni execute cheshtundi , dani name vwDB so ee vwDB lo unna results ni execute cheyocha ? ee vwDB anedi often change avthundi untundi so instead of directly executing ila cheyocha? sql kakapoina . net lo aina ? Hey, try similar code as following: Declare @temp1 table ( EmployeeName varchar(200), EmployeeNumber varchar(20) ) Insert into @temp1 Select distinct EmployeeName, EmployeeNumber from Employee Declare @record_count int, @Employee_ID varchar(20) Select @record_count = count(1) from @temp1 -- this will give record count in the table While (@record_count > 0) Begin Select @Employee_ID = (Select top 1 EmployeeNumber from @temp1) Select * from Department where EmployeeID = @Employee_ID Delete @temp1 where EmployeeNumber = @Employee_ID Select @record_count = count(1) from @temp End
andhravodu Posted August 21, 2015 Report Posted August 21, 2015 hi sql server lo oka view ni execute chesi ah vachina result view ni malli re execute cheyocha ? like for eg select Data from vwData where viewID = 4 so idi oka view 4 ni execute cheshtundi , dani name vwDB so ee vwDB lo unna results ni execute cheyocha ? ee vwDB anedi often change avthundi untundi so instead of directly executing ila cheyocha? sql kakapoina . net lo aina ? To get clarity. 1st query, select <column> from vwData where id = 4; 2nd query lo, what do you mean by execution Ex: 1st query result 100 vasthe Do you want to say, select * from <another table> where <filter> = 100 Ide ayithe select * from <another table> where <column> = (select data from vwData where id=4); This works with views also select * from <another table> where <column> = (select data from vwDb); -- If you get single row only Multiple rows vasthe, use In condition select * from <another table> where <column> in (select data from vwDb);
Recommended Posts