Showing posts with label unless. Show all posts
Showing posts with label unless. Show all posts

Sunday, March 11, 2012

compare results of 2 subqueries

i want to compare the results of 2 subqueries... something similar to this:
subquery1 IN subquery2

i cant use the IN unless subquery1 returns a single value i want to compare multiple results like for example:
('name1','name2') in ('name1','name2','name3') returns true

how can i acheive this?

thanks--Something like this

select
Result=
case when not exists(
select *
from pubs.dbo.titleauthor titleauthor
where authors.au_id=titleauthor.au_id
)
then 'false'
else 'true'
end
,*
from pubs.dbo.authors authors|||thanks for the reply

i want to know if a set of words which i get from my app are included in the list of words i get from the database.
do u suggest i insert these words in a temp table then use the query as u suggested or is there another way where i dont have to create a table.

thank you|||You can select from everything, but it would be much simpler, if table is in database.|||Thank you

since am building the sql query from my app it easier to select the values i have as they are without adding a new table.

Tuesday, February 14, 2012

Command Stack for Query Analyzer

Version 8.0
I am transitioning from Oracle and learning a new tool set and was surprised
to find there is no command stack in QA unless I am missing something. Is
there any way to quickly recall a past query from the query command line?
Thanks!
QA doesn't erase the commands that you execute. You can simply highlight
the one you want to execute and press F5.
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
..
"Mike Harbinger" <MikeH@.Cybervillage.net> wrote in message
news:e%23ZgmOYWEHA.4032@.TK2MSFTNGP11.phx.gbl...
Version 8.0
I am transitioning from Oracle and learning a new tool set and was surprised
to find there is no command stack in QA unless I am missing something. Is
there any way to quickly recall a past query from the query command line?
Thanks!