|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Looping QueryI know I have done this before but for the life of me I can remember how'
When I run the query below it loops and loops, how do I make it appear just once - missing something but brain freeze has taken over aaaggghhh.... select [T_GIFTCARDS].[M_CARDNUMBER], [T_GIFTCARDS].[M_SERIALNO], [transaction].[M_GIFTCARDNO], [transaction].[req_login_time] from [T_GIFTCARDS], [transaction] where req_login_time between '27 September,2004' and '28 September, 2004' your help much appreciated What do you mean by "The Query loops" ? A query doesn´t loop around on
its own, actually it doesn´t loop at all. same information in rows 1-84 shows up in query analyzer then row 85 shows
row 1 again then so on until row 829227262525.......or until system stops Show quote "Jens" wrote: > What do you mean by "The Query loops" ? A query doesn´t loop around on > its own, actually it doesn´t loop at all. > > =?Utf-8?B?SXZv?= (I**@discussions.microsoft.com) writes:
> I know I have done this before but for the life of me I can remember how' You have two tables in your WHERE clause, but there is no condition for> > When I run the query below it loops and loops, how do I make it appear > just once - missing something but brain freeze has taken over > aaaggghhh.... > > select [T_GIFTCARDS].[M_CARDNUMBER], [T_GIFTCARDS].[M_SERIALNO], > [transaction].[M_GIFTCARDNO], [transaction].[req_login_time] > from [T_GIFTCARDS], [transaction] > where req_login_time between '27 September,2004' and '28 September, 2004' joining them, which means that you get call possible combination of rows. If there are 1000 rows in T_GIFTCARDS, and there are a million rows in transactions for the given time range, the query will produce one milliard rows. -- Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx Erland Sommarskog skrev:
> You have two tables in your WHERE clause, but there is no condition for That would be one 'billion' in english, or are there even differences> joining them, which means that you get call possible combination of > rows. If there are 1000 rows in T_GIFTCARDS, and there are a million > rows in transactions for the given time range, the query will produce > one milliard rows. > between british and american english? (Not to mention Erland's swedish english ;) ) /impslayer, aka Birger Johansson impslayer (impsla***@hotmail.com) writes:
> That would be one 'billion' in english, or are there even differences See http://www.m-w.com/dictionary/milliard.> between british and american english? However, both in British and American English, they capitalise "British", "American" and "English". :-) But maybe we should table this discussion before it goes too far. (Now, let's see how many how get *that* one!) -- Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx Erland Sommarskog skrev:
> impslayer (impsla***@hotmail.com) writes: When will I ever (EVER!) learn to check stuff out before I make a> > That would be one 'billion' in english, or are there even differences > > between british and american english? > > See http://www.m-w.com/dictionary/milliard. > post??? Had no idea 'milliard' existed in English (sic!), and was hoping I'd clarify that you meant 'billion'... Definitely no cheap shot, I promise :) /impslayer, aka NoBrainPosterimpslayer (impsla***@hotmail.com) writes:
> When will I ever (EVER!) learn to check stuff out before I make a Rest assured that if I ever say "billion", I mean a real big billion, and> post??? > Had no idea 'milliard' existed in English (sic!), and was hoping I'd > clarify that you meant 'billion'... Definitely no cheap shot, I promise >:) not the wimpy billions they have over there! -- Erland Sommarskog, SQL Server MVP, esq***@sommarskog.se Books Online for SQL Server 2005 at http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Other interesting topics
|
|||||||||||||||||||||||