Click here to Skip to main content
15,075,944 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
table
current table detail
appMaterial appSubMaterial appSize appPcs appwts
Diamond ROUND DIAMOND 3 255 2.58
Gold GOLD 76% 2.54
Gold GOLD 92% 3.54


exactly my requirement below list how can make it query please help me sql server 2008r2
appma appsub apppu appcs appwt
gold gold 76% 255 2.55
gold gold 92% 0 3.55
Posted
Updated 8-Apr-14 0:35am
v2
Comments
Er. Puneet Goel 8-Apr-14 7:10am
   
means please provide more details! the above details are confusing
antish1 8-Apr-14 7:34am
   
As i have data as follow

1.gold 76% 25.25 wts
2.gold 92% 4.25 wts
3 chain 92% 10.25 wts

i want to display in sql2008
metal touch wts chain touch wts
gold 76% 25.25 chain 92% 10.25
gold 92% 4.25

touch should not be fixed
Er. Puneet Goel 8-Apr-14 7:36am
   
what do you mean by 'not fixed'?
antish1 8-Apr-14 7:40am
   
touch mean 92% , 76%, 86% 56% so we cant fixed the touch
we cannt fixed the touch as it is many
antish1 8-Apr-14 7:47am
   
please suggest me how can build sql query
Er. Puneet Goel 8-Apr-14 7:47am
   
you seems to be confused! this is improper question or In-sufficient details. Please post some valid info about it.
antish1 8-Apr-14 7:52am
   
already insert data in table
below
1.gold 76% 25.25 wts
2.gold 92% 4.25 wts
3.chain 92% 10.25 wts
now i want in above table using record get need output below

gold 76% 25.25 chain 92% 10.25
gold 92% 4.25
antish1 8-Apr-14 8:00am
   
now understand ??
Er. Puneet Goel 8-Apr-14 8:16am
   
mean you want records grouped by metal ?
antish1 8-Apr-14 8:31am
   
group by touch
Er. Puneet Goel 8-Apr-14 8:45am
   
means you want to get all record group by Metal like all Gold, than all chain ?
antish1 8-Apr-14 8:49am
   
yeah only two type group Gold and Chain
Er. Puneet Goel 8-Apr-14 8:52am
   
i will post the solution, if you have any query let me know in the same
antish1 8-Apr-14 9:07am
   
yeah you are right but i need only two type in metal also same chain only one row display

like say

Metal type
Gold 76
Gold 92
chain 76 chain
chain 92 chain

i want need below

typegold chaintype
76 76chain
92 92 chain
antish1 10-Apr-14 1:50am
   
please tell me how can it possible

1 solution

1.
SQL
Select * from table where metal = 'Gold' OR metal = 'Chain' order by metal


This will give you only two metal group gold and chain with gold and chains together

2. for group by query please provide exact column names and data types
   
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