Professional Web Applications Themes

How to do a select on a column with no repeats - MySQL

Hello all, I'm needing to do a select on a certain column of a database and have the results returned with no repeats. For example, say I have a table of addresses and one of the columns is the state. I have 5 entries in the table and three of them are in the state of Texas. When I do a select for the state from the table I want it to only return Texas as a result only once instead of three times. Is this possible? Thanks!...

  1. #1

    Default How to do a select on a column with no repeats

    Hello all,

    I'm needing to do a select on a certain column of a database and have
    the results returned with no repeats. For example, say I have a table
    of addresses and one of the columns is the state. I have 5 entries in
    the table and three of them are in the state of Texas. When I do a
    select for the state from the table I want it to only return Texas as a
    result only once instead of three times.

    Is this possible? Thanks!

    Bryan Guest

  2. #2

    Default Re: How to do a select on a column with no repeats

    Oops... I bet I can get what I want if I use the DISTINCT keyword
    huh...

    On Dec 28, 8:51 pm, "Bryan" <com> wrote: 

    Bryan Guest

  3. #3

    Default Re: How to do a select on a column with no repeats

    Bryan wrote: 

    http://dev.mysql.com/doc/refman/5.1/en/select.html

    See the DISTINCT keyword.

    --
    ==================
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    net
    ==================
    Jerry Guest

  4. #4

    Default Re: How to do a select on a column with no repeats

    Is it possible to do an SQL query on a result set from a previous SQL
    query?

    On Dec 28, 8:54 pm, "Bryan" <com> wrote: 

    > [/ref]

    Bryan Guest

  5. #5

    Default Re: How to do a select on a column with no repeats


    Bryan wrote: 
    > > 
    > > [/ref][/ref]

    Yes (see VIEWS), however I'm sure a brief skim through the manual
    would answer all these questions. You might even discover how to do the
    entire query with just one statement (see sub-queries and/or JOINS).

    strawberry Guest

Similar Threads

  1. select a column with a condition
    By gehegeradeaus@gmail.com in forum MySQL
    Replies: 4
    Last Post: December 6th, 11:57 AM
  2. Adding a select column...
    By Paul Mason in forum ASP.NET Data Grid Control
    Replies: 2
    Last Post: August 31st, 05:54 PM
  3. Getting column name in Select statement
    By Jane in forum Microsoft SQL / MS SQL Server
    Replies: 1
    Last Post: July 8th, 04:17 PM
  4. Button Select Column
    By mark in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: July 5th, 10:57 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139