×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Question about a query

Question about a query

Question about a query

(OP)
Hello all, I was wondering how do to something.  I have a table that I need to do some kind of sub query.  I am learning so this query eill teach me a lot.  I have 2 columns One is the ID and the other is Num.  I need to search for all Nums that have a "0" in it and get the ID of that row.  I then need to search in the column "Num" and get match the row id.  I think this would be an embedded search (something like that).

Here is my columns.

CODE

ID     Num
2     0     
3     2     
4     2
I will attempt the query string:

CODE

select Num from table where Num = (select ID from Num where Num = 0 )
Something like that.  I want to learn how to do this kind of search.

Thanks,
timgerr

-How important does a person have to be before they are considered assassinated instead of just murdered?
Congratulations!

RE: Question about a query

select b.num
from table a
inner join table b
on a.id = b.num
where a.num = 0

NOT TESTED!!!

RE: Question about a query

select Num from table where Num = (select ID from Num where Num = 0 )

in this case the sub query should result a single ID.(according to query)



select ID from table where Num IN (select ID from table where Num = 0 )

in this case the sub query should result multiple IDs.
(So it works fine)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close