Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Select statement!!!

Status
Not open for further replies.

chassid

MIS
Aug 27, 2000
58
US
B"H
Dear All,

Using ASP, I am displaying the values of an Access Database.
I have been trying to create a select statement where only the fields under the column chapter that equal to south should display. I have tried it several different ways using Len statements and etc. Anyone would be fine, this is probably pretty easy. Does anyone know how to build this select statement?

All help will be greatly appreciated!

Daniel [sig][/sig]
 
chassid,
from your statement this is my understanding...

here is the SQL Statement:

Dim strQuery as String
strQuery = &quot;Select chapter from <table> where chapter='south'&quot;
'Open a recordset
'statements follow

<table> = table to be used.

hope this help, [sig]<p>Jun Nantes<br><a href=mailto:bhudz@junnantes.com>bhudz@junnantes.com</a><br><a href= Nantes Official Internet Site</a><br>[/sig]
 
Try something like this, it's the basic idea.

<SELECT>
<%

Response.write &quot;<OPTION>&quot; & objRS.field(&quot;ColumnName&quot;) & &quot;</OPTION>&quot;
objRS.movenext
%>
</SELECT> [sig]<p>Ben Marshalsea<br><a href=mailto: > </a><br><a href= [/sig]
 
Thanks everybody for the help!!!

Nic,
What I am trying to do is search for all records under the column chapter that equal to south. Chapter is a column and south is a field common to several records. If you have any ideas please send me how you think it should be done.

Junnantes, I think you've got, it I will try it. For some reason I tried something similar, but it didn't work. Let me see if it will work the way you wrote it.

Thanks everyone for the help.

Daniel [sig][/sig]
 
Nic,

Well, I call column the words that are at the top of a column heahehaea, like column name of something. Fields are the names that are underneath that column. How would you call that?

Ex:
Chapter
-------
South
North
East
West

Thanks,
Daniel
[sig][/sig]
 
Still, this is the statement:
&quot;Select * from table_name where chapter = 'south'&quot;
 
Daniel,

ya Nic was right about the terminology, column & field mean the same thing. now, you are asking how should we call the one beneath the column, well it is called row or record or data.

thanks for trying my codes, hope that works.

addt'l tip:
if your not sure of the case of your data try using the UPPER function. This function will force all the data in column Chapter to be all in UpperCase. your SQL would look like this:

strQuery = &quot;Select chapter from <table> where UPPER(chapter)='SOUTH'&quot;
[sig]<p>Jun Nantes<br><a href=mailto:bhudz@junnantes.com>bhudz@junnantes.com</a><br><a href= Nantes Official Internet Site</a><br>[/sig]
 
Daniel,

sorry about the UPPER function it should be UCASE.

thnx, [sig]<p>Jun Nantes<br><a href=mailto:bhudz@junnantes.com>bhudz@junnantes.com</a><br><a href= Nantes Official Internet Site</a><br>[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top