Announcement

Collapse
No announcement yet.

SELECT DISTINCT problems

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SELECT DISTINCT problems

    When I use SELECT DISTINCT, when I try to add another field for it to get, it gets a distinct of that as well, making the other one void because its getting more then it should. So how do I get more than one field for SELECT DISTINCT

  • #2
    I'm corn-fuzed.

    Are you looking for "DISTINCT ROW"?

    Comment


    • #3
      ok, i'll try and explain it better.

      When normally selecting all the data from something you put

      SELECT * FROM table

      if you want a distinct of something you put

      SELECT DISTINCT field1 FROM table

      what i want to do is combine them so that i can get more than one data field. but when i tried

      SELECT field2, field3, DISTINCT field1 FROM table

      it didn't work and when i tried

      SELECT DISTINCT field1, field2, field3 FROM table

      it didn't select just the distinct of field 1

      Comment


      • #4
        try something like...

        SELECT field1, field2, field3, COUNT(field3) as num FROM table_name WHERE num=1

        Comment

        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
        Working...
        X