display data's only ones

Results 1 to 2 of 2

Thread: display data's only ones

  1. #1
    Ramesh Thiruchelvam Guest

    Default display data's only ones

    In my database one field contains data like flowing<BR><BR>Hospital<BR>Shop<BR>Super Market<BR>Hospital<BR>Hospital<BR>Shop<BR><BR>Ok now I want to display data&#039s only ones like<BR><BR>Hospital<BR>Shop<BR>Super Market<BR><BR>So how can I do this ? Please help me!<BR>if you can ...<BR>Can you explain me that in this example?<BR>Here I have the field as fldCat <BR>I hope you will help me ……….<BR><BR>&#060;%<BR>Conn_String = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Request.ServerVariables("APPL_PHYSICAL_PATH") & "list/dblist.mdb"<BR>set my_conn = Server.CreateObject("ADODB.Connection")<BR>set objRec = Server.CreateObject("ADODB.Recordset")<BR>my_Conn. Open (conn_string)<BR><BR>SQL = "SELECT * FROM tblList"<BR><BR>objRec.Open Sql, my_conn, 1, 1<BR><BR>Do until objRec.EOF<BR><BR>response.write objRec("fldCat") & "<BR>"<BR><BR>objRec.MoveNext<BR>Loop<BR>&#037;&#0 62;<BR>

  2. #2
    Join Date
    Dec 1969
    Posts
    511

    Default RE: display data's only ones

    You just need to change you SQL statement a little. SQL&#039s a wonderful thing, takes all the hard work out of it :)<BR><BR>try :<BR><BR>SELECT DISTINCT tblList.fldCat <BR>FROM tblList<BR><BR>The keyword DISTINCT just removes any duplicates from the returned data. You might what to stick an ORDER BY &#060;filedname> on the bottom of the SQL statement too. This will sort the result into alphabetical order. Like so:<BR><BR>SELECT DISTINCT tblList.fldCat <BR>FROM tblList<BR>ORDER BY tblList.fldCat<BR><BR>Pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •