Home All Groups Group Topic Archive Search About

Simple but useful technique - is it possible?

Author
3 May 2006 6:52 PM
Uday
Lets say, I have two groups of numbers (1,2,3,4,5...) and (1,8,3,6,1,4,...)
[doesnt matter what the numbers are, as long as they are numbers]

If I want to get a list of matching/non-matching numbers using a query,
without creating any tables....
like:

-- all numbers in g2 that match with g1
select *
from (1,2,3) as g1
left outer join (2.3.4) as g2
where g1.something = g2.something
and g2.something is null

I hope the question makes sense.....

Is it possible to do something like this....?
(I did something like this a while ago... but can't remember what it is)

I know this is anti-RDBMS...  but I do a lot of 'ID'-matching to get needed
ID's before generating any reports
[cross check technique]

Any help is appreciated,
_Uday

Author
3 May 2006 7:15 PM
Sylvain Lafontaine
Some kind of school work?

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF


Show quote
"Uday" <U***@discussions.microsoft.com> wrote in message
news:7CC65E2D-69A2-45B6-A6B2-188B6FF01E2F@microsoft.com...
> Lets say, I have two groups of numbers (1,2,3,4,5...) and
> (1,8,3,6,1,4,...)
> [doesnt matter what the numbers are, as long as they are numbers]
>
> If I want to get a list of matching/non-matching numbers using a query,
> without creating any tables....
> like:
>
> -- all numbers in g2 that match with g1
> select *
> from (1,2,3) as g1
> left outer join (2.3.4) as g2
> where g1.something = g2.something
> and g2.something is null
>
> I hope the question makes sense.....
>
> Is it possible to do something like this....?
> (I did something like this a while ago... but can't remember what it is)
>
> I know this is anti-RDBMS...  but I do a lot of 'ID'-matching to get
> needed
> ID's before generating any reports
> [cross check technique]
>
> Any help is appreciated,
> _Uday
Author
3 May 2006 8:03 PM
Uday
good one..!!
[is that what my question sounds like..!!  LOL..]
Author
4 May 2006 4:53 PM
Sylvain Lafontaine
Not really a joke as you did not explain what you mean by « without creating
any tables ».

Does the creation of a temporary table or local variable table or the use of
a function that will return a table is permitted or if this is also out of
question?

And how are represented your groups of numbers (1,2,3,4,5...) and
(1,8,3,6,1,4,...) ?   As a long list of parameters or encoded in a string or
what else?

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: http://cerbermail.com/?QugbLEWINF


Show quote
"Uday" <U***@discussions.microsoft.com> wrote in message
news:E3EFF7D3-CE7F-42BE-8346-900EAAD4B425@microsoft.com...
> good one..!!
> [is that what my question sounds like..!!  LOL..]
Author
3 May 2006 7:20 PM
Anith Sen
The only structure in SQL is a table. So you will have to come up with a way
of representing your data as a relational table ( derived relation ) as:

SELECT *
  FROM ( SELECT 1 UNION SELECT 2 UNION SELECT 3 ) g1 ( c )
  LEFT OUTER JOIN
       ( SELECT 2 UNION SELECT 3 UNION SELECT 4 ) g2 ( c )
    ON g1.c = g2.c
WHERE g2.c IS NULL ;

--
Anith
Author
3 May 2006 8:01 PM
Uday
Thanks Anith,
I'll just do it in Excel... like I always do..!!

AddThis Social Bookmark Button