I was wondering if anyone knows the solution to the following;
I want to union the same table on itself whilst returning a random result based on a with statement... Im sure the following code (which doesnt work) will explain what im attempting much easier.
SELECT TOP 1 * FROM tableName WHERE field = x ORDER BY newid() UNION ALL SELECT TOP 1 * From tableName WHERE field = y ORDER BY newid() .. etc
SELECT * FROM (
SELECT TOP 1 *
FROM tableName
WHERE field = x
ORDER BY newid()
) a
UNION ALL
SELECT * FROM (
SELECT TOP 1 *
From tableName
WHERE field = y
ORDER BY newid()
) b
Yeah, sorry for not posting lately. A few business things, and a few family things have kept me pretty busy lately. But all is well and I should be around much more now