如何在SELECT QUERY(mysql)中获取唯一的10行 [英] how to get unique 10 rows in SELECT QUERY (mysql)

查看:110
本文介绍了如何在SELECT QUERY(mysql)中获取唯一的10行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在SELECT QUERY(mysql)中获取唯一的5行

它是我的表

id name

1 test5
2 test1

3 test2

4 test3

5 test4

6 test6


i希望在php中获取我的数据,其中id = 1,2,4,6,3





请帮帮我........

how to get unique 5 rows in SELECT QUERY (mysql)
it is my table
id name
1 test5
2 test1
3 test2
4 test3
5 test4
6 test6

i want to fetch my data in php where id=1,2,4,6,3


please help me........

推荐答案

使用in子句筛选多个ID

对唯一记录(行)使用distinct

use in clause for filter for multiple ids
use distinct for unique records(rows)
Select distinct * from tablename 
where id in (1,2,4,6,3)



Happy Coding!

:)


Happy Coding!
:)


这篇关于如何在SELECT QUERY(mysql)中获取唯一的10行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆