ms access - SQL Alternative to For Loop -
i'm working sql in access. i'm not of programmer, i'm familiar using vba sql basics.
what i'm trying accomplish equivalent in sql of loop used in visual basic. know isn't "technically" possible in sql , may not best method i'm looking advice. know can accomplished i=1,2,3, etc. using unions , repeating query each value. inefficient , gets complex evaluated.
basically need method query i=1 repeat , again output data i=2 , on. using group not option because there several subqueries involved well.
thanks in advance!
without lot of context, can't provide better answer, can accomplish of loop in sql.
declare @ctr integer set @ctr = 1 while @ctr < 1000 begin --do logic select @ctr = @ctr + 1 end
but isn't efficient use of sql. should able write need without iterating on it. think in sets , along better rdbms.
Comments
Post a Comment