SQL Query WHERE CLAUSE question

S

shripaldalal

Hi,

Have a simple question.........

select * from mytable inner join myaccounts on mytable.id =
myaccounts.sub_id where mytable.party = 'shripal dalal' and on_acc_of
= 'inv/1/07'

I know the above WHERE CLAUSE is possible if i know the fieldname
'party', 'on_acc_off' but what if i dont know the fieldnames in the
tables ?

is something like this possible :

select * from mytable inner join myaccounts on mytable.id =
myaccounts.sub_id where any_field_in_this_query = 'shripal dalal' and
any_field_in_this_query = 'inv/1/07'

THIS WILL REALLY SOLVE A BIG PROBLEM !

regards,
shripal.
 
R

Rick Brandt

shripaldalal said:
Hi,

Have a simple question.........

select * from mytable inner join myaccounts on mytable.id =
myaccounts.sub_id where mytable.party = 'shripal dalal' and on_acc_of
= 'inv/1/07'

I know the above WHERE CLAUSE is possible if i know the fieldname
'party', 'on_acc_off' but what if i dont know the fieldnames in the
tables ?

is something like this possible :

select * from mytable inner join myaccounts on mytable.id =
myaccounts.sub_id where any_field_in_this_query = 'shripal dalal' and
any_field_in_this_query = 'inv/1/07'

THIS WILL REALLY SOLVE A BIG PROBLEM !

regards,
shripal.

That is not possible.
 
D

doco

You will need to review each field.

after setting the sql and opening the datasource

with rs
if not .eof and if not .bof then

do until .eof
for i = 10 to .fields.count -1
if .fields(i) = myValue then
do something
end if
next i
.movenext
loop
end with

HTH
 
J

John Spencer

As far as I know, there is no way to do what you want using Access.

If you want to search multiple fields, you will have to apply your criteria
against each field.

You might post what problem you are trying to solve.

Your requests suggests to me that your table structure is in need of a
re-design.
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 

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

Top