| Author |
Is it possible to connect 2 select statements into one
|
john mattucci
Ranch Hand
Joined: Nov 03, 2000
Posts: 331
|
|
ELSE IF(@number = 2) BEGIN SELECT COUNT([outlet #]) FROM OM WHERE [address] LIKE '%' + @address + '%'; SELECT [outlet #], [name], address, [city/town], [postal code], telephone FROM OM WHERE address LIKE '%' + @address + '%' END Would it be possible to obtain the # of records and records in one shot Thank u for your time
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15229
|
|
You would want to use a sub query. I am not sure if what I am showing you will work, but it will be something similar to: SELECT [outlet #], [name], address, [city/town], [postal code], telephone, (SELECT COUNT([outlet #])) FROM OM WHERE address LIKE '%' + @address + '%' Hope that helps. BTW - The query will be analized starting with the sub query, so it will do the COUNT first and then work it's way out. [ September 02, 2002: Message edited by: Gregg Bolinger ]
|
 |
 |
|
|
subject: Is it possible to connect 2 select statements into one
|
|
|