Re: Adding lines to a table base on a Quanitity
From: David Portas (REMOVE_BEFORE_REPLYING_dportas_at_acm.org)
Date: 03/21/04
- Next message: Lloyd Sheen: "Re: sybase newsgroup"
- Previous message: Karl Gram: "Re: Loop for Quantity"
- In reply to: Mike: "Re: Adding lines to a table base on a Quanitity"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 21 Mar 2004 22:41:06 -0000
Sorry, I got the BETWEEN expressions swapped around. This should do it:
INSERT INTO Something (member_no, number, ....)
SELECT T.member_no, N.number, ....
FROM Tickets AS T
JOIN Numbers AS N
ON N.number BETWEEN 1 AND T.ticket_qty
> need it to loop through each member number.
I suspect that's not what you *need*. SQL is primarily a declarative
language, not a procedural one. The best starting point when writing a query
is to define the result you require (the output of the query) rather than
how to get it (e.g. a loop).
Hope this helps.
-- David Portas SQL Server MVP --
- Next message: Lloyd Sheen: "Re: sybase newsgroup"
- Previous message: Karl Gram: "Re: Loop for Quantity"
- In reply to: Mike: "Re: Adding lines to a table base on a Quanitity"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|