Jump to content

[SOLVED] Getting one number from records


wwfc_barmy_army

Recommended Posts

Hello.

I have a table and in that table is a field with either 1,2,3,4...10. Although a number of records can have for example number 1.

[b]Example[/b]
[table][tr][td]Field 1[/td][td]Field 2 (number field)[/td][/tr]
[tr][td]name[/td][td]1[/td][/tr]
[tr][td]name[/td][td]1[/td][/tr]
[tr][td]name[/td][td]1[/td][/tr]
[tr][td]name[/td][td]2[/td][/tr]
[tr][td]name[/td][td]3[/td][/tr][/table]

So i would want it to print 1,2,3 not 1,1,1,2,3.

How would i do this?

Thanks.
Link to comment
https://forums.phpfreaks.com/topic/31088-solved-getting-one-number-from-records/
Share on other sites

I'm not sure I understand exactly what you mean, the following query will give what you've asked for, but whether it's actually what you want is another thing all together:

[code=php:0]SELECT DISTINCT field_2 FROM table_name ORDER BY field_2[/code]

Regards
Huggie

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.