Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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...
Posted

1 solution

ee_persian wrote:
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]


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]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900