从SQL Server检索值 [英] retrieve value from sql server

查看:105
本文介绍了从SQL Server检索值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 选择 * 来自 AdvertisementInformation '  AND (AdType = 想要的  or  AdType = ' 提供')




但是它只提供一个记录,一个要记录,我想从sql数据库的两个值中检索所有记录

数据库

解决方案

中存在关于如何查找表数量的查询是什么?检查您的数据:所述查询应返回SubCategory为"Home"的所有记录. Tutor"和AdType是"Wanted"或"Offer"-检查您的某些字段中是否没有可用空间或类似内容.

表格数量:

  SELECT  COUNT(TABLE_NAME) FROM  INFORMATION_SCHEMA.TABLES 


1.

 选择 * 来自 AdvertisementInformation 其中 SubCategory = ' 家庭教师' > AND  AdType  IN (' 想要的 span>,' 提供')



2.

 选择 COUNT(name)来自 sys.tables '  选择 * 来自 AdvertisementInformation 其中 AdType = ' 希望'  AdType = ' 提供' 


查询以找到编号.数据库中表的数量

 选择 count(*)来自 sys.tables 


祝您编码愉快!
:)


select * from AdvertisementInformation where SubCategory ='Home Tutor' AND ( AdType ='Wanted' or AdType ='Offer')




but it give only one record for offer and one record for wanted and i want to retrieve all records from both values from sql database

and what is the query for how to find the number of tables exists in database

解决方案

Check your data: that query as stated should return all record where SubCategory is "Home Tutor" and AdType is either "Wanted" or "Offer" - check you don''t have spare spaces or similar in some of your fields.

For the count of tables:

SELECT COUNT(TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES


1.

select * from AdvertisementInformation where SubCategory ='Home Tutor' AND  AdType IN('Wanted' ,'Offer')



2.

select COUNT(name)from sys.tables  where type='u'


Query for retrieve all records from both values (offer and wanted) from sql database

select * from AdvertisementInformation where AdType ='Wanted' or AdType ='Offer'


Query to find no. of tables in database

select count(*) from sys.tables


Happy Coding!
:)


这篇关于从SQL Server检索值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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