I have a question:
Does it possible to collect multiple query in one query?
i.e in a Form I have 10 query like this:
1. SELECT ThisValue FROM thatTable1 WHERE
2. SELECT ThisValue FROM thatTable2 WHERE
.......
10. SELECT ThisValue FROM thatTable10 WHERE
where should I write i.e this code in Access.It it possible in Access or only I can do that in MS SQL and….
CREATE PROC dbo.proc_app_CollectControlData
AS
SET NOCOUNT ON
DECLARE @t TABLE
(
CONTROLNAME nvarchar(74),
CONTROLVALUE nvarchar(255)
)
-- Now we collect the data for the 10 different controls
INSERT INTO @t
(CONTROLNAME, CONTROLVALUE)
SELECT 'MyFirstControl',
ThisValue
FROM dbo.ThatTable
WHERE Condition1
...
INSERT INTO @t
(CONTROLNAME, CONTROLVALUE)
SELECT 'MyTenthControl',
ThisValue
FROM dbo.ThatTable
WHERE Condition10
-- And now we return all found data to the client
SELECT * FROM @
SET NOCOUNT OFF
GO
I think you are looking for the UNION Operator.