run SQL statement from same SQL statement for searching

M

Mike

I am trying to search for value in my SQL statement. In anther word I am
trying to run SQL statement from same SQL statement for searching

I did try the following and it is not working.

1)
SELECT mytable.ID
FROM
SELECT ID
FROM TableName WHERE TableName.ID In (1,2,3,4,5)
as mytable,
SELECT ID
FROM TableName WHERE TableName.ID = 1 as
mytable1,
where mytable1.id = mytable.id ;

2)
SELECT Date FROM Store_Information
MINUS
SELECT Date FROM Internet_Sales

Any Idea
 
T

Tim Ferguson

I am trying to search for value in my SQL statement. In anther word I am
trying to run SQL statement from same SQL statement for searching

Answered above -- if you want to restate the question it's better to keep
it in the same thread.

The query you have posted is meaningless: how about asking what it is that
you are actually trying to do?

All the best


Tim F
 
M

Mike

Hi Tim ,

I have a form. User can select a value from this form and if there is too
much record they can select again from their selection. For example if they
select Id 1,2,3 and name is Tim they can go back and select 1 from same list.
In another word I am trying to use subquery.

Thank,
Mike
 
M

Mike

Sorry Tim I gave a wrong example, They right example is. If the user selects
Id 1,2,3 and name is Jim, Jim and Tim they can select Tim from the list and
they got only one record instead of all Tim record from this table. because
if they select 1 and Tim they will receive more record.
 
M

Mike

Thanks Tim for your help I did that way and its work

SELECT ID
FROM mytable
WHERE ID
in (SELECT ID
FROM mytable
WHERE ID In (1,2,3,4)
and ID = 1;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top