Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6664467
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:36:50+00:00 2026-05-26T02:36:50+00:00

I am trying to come up with the proper query for my problem. Basically,

  • 0

I am trying to come up with the proper query for my problem. Basically, I might have over 100 of the exact same result if I do:

    $query = "SELECT * FROM highway WHERE state  = 'VA'";
    $result = mysql_query($query) or die(mysql_error());
    while ($row = mysql_fetch_array($result)) {
    //code

With this I would get:

    95
    95
    95
    95 (and on and on...)
    64
    64
    64 (and on and on...)

What would be the proper query to just get:

    95
    64
    66
    81
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:36:51+00:00Added an answer on May 26, 2026 at 2:36 am

    You can use the DISTINCT keyword:

    The ALL and DISTINCT options specify whether duplicate rows should be
    returned. ALL (the default) specifies that all matching rows should be
    returned, including duplicates. DISTINCT specifies removal of
    duplicate rows from the result set. It is an error to specify both
    options. DISTINCTROW is a synonym for DISTINCT.

    So:

    SELECT DISTINCT * FROM highway WHERE state  = 'VA'
    

    But if your resultset has duplicates when considering certain columns, it seems to me that your database tables are likely poorly designed. Have you considered further normalising them?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to come over to java from C++ and am having some
I have come up to issues while I'm trying to write some classes, here
I'm trying to come up with a validation expression to prevent users from entering
I'm trying to come up with a MySQL query that will update points ...
I have been trying to follow this example from propel to configure a custom
I am trying come up with a way to pull the tables out of
im trying to come up with a design for a wrapper for use when
I am trying to come up with the best way to render some hierarchical
I've been trying to come up with a way to create a 3 column
I'm trying to come up with a Java regex that will match a filename

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.