Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Newbie Question

Author  Topic 

Dasman
Yak Posting Veteran

79 Posts

Posted - 2011-06-01 : 14:11:39
Hello Everyone:

Individually these two SELECT statements work:

SELECT * FROM table_name
WHERE Weight
BETWEEN 60 AND 80
ORDER BY Weight DESC


SELECT * FROM table_name
WHERE Height
BETWEEN 1.8 AND 1.9
ORDER BY Height DESC

and it results in two tables. Is there anyway to find the data that intersects between these two queries?

Thanks,
Dasman

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-06-01 : 14:17:54
Intersection:

SELECT * FROM table_name
WHERE Weight
BETWEEN 60 AND 80 AND
Height
BETWEEN 1.8 AND 1.9
ORDER BY Weight DESC

Go to Top of Page

Dasman
Yak Posting Veteran

79 Posts

Posted - 2011-06-01 : 14:22:30
Just to clarify
My end goal would be to get a table of people whos weight is from 60 to 80 and height between 1.8 to 1.9.

The data for both of the select queries are from the SAME table just two different columns in the same table.
Go to Top of Page

Dasman
Yak Posting Veteran

79 Posts

Posted - 2011-06-01 : 14:24:16
Thank you soo much! It works! :)
Go to Top of Page
   

- Advertisement -