如何从Master Table查询状态? [英] How to query for state from Master Table?

查看:166
本文介绍了如何从Master Table查询状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何编写查询以从MASTER表中获取状态名称?条件就像不应该重复相同的状态。例如,在主表中有1000条记录,其中100条记录具有州名KARNATAKA,另外一条KERALA包含100条记录。所以我想只获得不应该重复的州名?那么任何人都可以帮我找到这个查询吗?



此查询显示所有(1000)记录

从MasterTable中选择StateName



感谢@ dV @ nCe ........:P

解决方案

 选择 不同 StateName 来自 MasterTable 











 从<选择 StateName  / span> MasterTable  group   by  statename 


只需添加不同的关键字..





从MasterTable中选择不同的StateName 


How to write a query to get state names from MASTER Table? Condition is like should not repeat same state. For example in master table there are 1000 records in that 100 records has State name 'KARNATAKA' and one more state 'KERALA' contains 100 records. So I want to get only state names which should not repeat? So Can any one help me to find this query?

This query is displaying all(1000) records
"Select StateName from MasterTable"

Thanks in @dV@nCe........:P

解决方案

Select Distinct StateName from MasterTable



or


Select StateName from MasterTable group by statename


simply add distinct keyword..


Select distinct StateName from MasterTable


这篇关于如何从Master Table查询状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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