sql语言-选择语句 [英] sql language - select statement

查看:91
本文介绍了sql语言-选择语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我对软件sql server和SQL语言的疑问是.

如何在一个表中获得表中所有记录,每个记录中都有重复的数字?

例如,第一个表名为"Type",第二个表"sales"为.

希望将表类型"中的所有现有物料与表销售"中的每个编号一起列出.

我使用了此命令,但我不对.

选择种类不同的(SELECT count(*)from kind where kind.[k_id] = sell.[k_id]),kind.[k_id],[k_type],[k_mod],[k_color],[k_num],[k_count], [k_buy],[k_sell]来自kind,在何处出售.[k_id] = sell.[k_id]

每个产品显示的输出命令始终为1.
请帮助...

Hi all

My question about software sql server and the SQL language is.

How are all the records in a table with a number repeated in each record gained in a table?

For example, the first table named "Type" and the second table "sales" is.

Would like all existing materials in the table "Type" to accompany each number in the table "sales" to list.

I use this command, but I was not right.

select distinct (SELECT count(*) from kind where kind.[k_id]=sell.[k_id]) , kind.[k_id],[k_type],[k_mod],[k_color],[k_num],[k_count],[k_buy],[k_sell] from kind , sell where kind.[k_id]=sell.[k_id]

Output command is always number 1 for each product shows.
Please help...

推荐答案

ee_persian写道:
ee_persian wrote:

选择不同的(SELECT计数(*)from kind where kind.[k_id] = sell.[k_id]),kind.[k_id],[k_type],[k_mod],[k_color],[k_num],[k_count],[k_buy],[ k_sell]从kind处出售.[k_id] = sell.[k_id]

select distinct (SELECT count(*) from kind where kind.[k_id]=sell.[k_id]) , kind.[k_id],[k_type],[k_mod],[k_color],[k_num],[k_count],[k_buy],[k_sell] from kind , sell where kind.[k_id]=sell.[k_id]



仅使用此内容-
SELECT * from kind where kind.[k_id]=sell.[k_id]) , kind.[k_id],[k_type],[k_mod],[k_color],[k_num],[k_count],[k_buy],[k_sell] from kind , sell where kind.[k_id]=sell.[k_id]



Use just this instead -
SELECT * from kind where kind.[k_id]=sell.[k_id]) , kind.[k_id],[k_type],[k_mod],[k_color],[k_num],[k_count],[k_buy],[k_sell] from kind , sell where kind.[k_id]=sell.[k_id]


这篇关于sql语言-选择语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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