| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | your stored procedure question |
I'm here via Dale's mirror, got stuck in sleep disconnect and now can't get back to your message, but here's my reply: If you mean it all has to look like one table, that's easy, just make a derived table out of it: SELECT x.* FROM (SELECT w.WRKNO , w.RELNO , c.CO_ID , c.LOTID , s.COLOR , CONVERT(char(6), w.WRKNO) + ' ' + c.LOTID + ' ' + SFC_Colors.COLOR) AS LISTCOL FROM WorkOrder w INNER JOIN CombOrder c ON w.WO_ID = c.WO_ID LEFT JOIN SFC_Colors s ON c.COLOR_ID = s.COLOR_ID WHERE w.ACTIVE = 1 AND c.ACTIVE = 1) x ORDER BY x.WRKNO, x.LOTID (You can't put the ORDER BY in the definition of a derived table.) Note that a derived table is something SQL Server really likes and can use very efficiently, it's not at all the same thing as a subquery in terms of performance. Whether you can open a cursor on it is another question though. Personally I don't use cursors so I'm not knowledgable about their ins and outs. Cursors are considered not really "SQL-ish" (for lack of a better word) and are also reputed to have a really bad effect on performance. Are you sure a cursor is the best way to solve your problem? P.S. I'm writing this from Montreal, this is the first time I've checked in in several days... I feel bad that I wasn't there when you first asked your question. --- BBBS/NT v4.01 Flag-5* Origin: Barktopia BBS Site http://HarborWebs.com:8081 (1:379/45) SEEN-BY: 633/267 270 @PATH: 379/45 1 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.