Click here to Skip to main content
15,921,531 members
Home / Discussions / Database
   

Database

 
GeneralRe: transfering data fro one table to another Pin
Ashfield5-Nov-08 21:01
Ashfield5-Nov-08 21:01 
GeneralRe: transfering data fro one table to another Pin
Muditha Dissanayake6-Nov-08 4:39
Muditha Dissanayake6-Nov-08 4:39 
Questionwhere can i find the northwind sql script Pin
prasadbuddhika4-Nov-08 23:58
prasadbuddhika4-Nov-08 23:58 
AnswerRe: where can i find the northwind sql script Pin
cyber-drugs5-Nov-08 0:12
cyber-drugs5-Nov-08 0:12 
GeneralRe: where can i find the northwind sql script Pin
prasadbuddhika5-Nov-08 0:34
prasadbuddhika5-Nov-08 0:34 
GeneralRe: where can i find the northwind sql script Pin
cyber-drugs5-Nov-08 0:41
cyber-drugs5-Nov-08 0:41 
AnswerRe: where can i find the northwind sql script Pin
Wendelius5-Nov-08 10:38
mentorWendelius5-Nov-08 10:38 
QuestionFiltering Query results Pin
Andy_L_J4-Nov-08 23:28
Andy_L_J4-Nov-08 23:28 
I am not too good with T-SQL...

I have a Temp Table with the following data:

Date    Line    WGT   ....    Form
XXX     1       126   ....    ABC
XXX     1       124   ....    ABC
XXX     1       126   ....    EFG
XXX     2       126   ....    ABC
XXX     2       123   ....    EFG
XXX     8       124   ....    EFG
XXX     8       126   ....    EFG
XXX     8       127   ....    HIJ
XXX     8       126   ....    HIJ
...


I need to query this table as follows:

Select the Rows for Each 'Line' that have the lowest 'WGT' where the FORM value is distinct for that 'LINE'.

Does That make sense?

Output should be like:

DATE    LINE    WGT   ....   FORM
XXX     1       124   ....   ABC
XXX     1       126   ....   EFG
XXX     2       126   ....   ABC
XXX     2       123   ....   EFG
XXX     8       124   ....   EFG
XXX     8       126   ....   HIJ
...


I have tried every variation of distinct, min and group by that I can think of. I am thinking of resorting to UDF's but I know deep down in my inner Geek that this is simple. Any tips before I bore apall you with my pathetic T-SQL?

CODEZ nOT URGNT Big Grin | :-D Wink | ;)

I don't speak Idiot - please talk slowly and clearly

AnswerRe: Filtering Query results Pin
J4amieC5-Nov-08 0:57
J4amieC5-Nov-08 0:57 
GeneralRe: Filtering Query results Pin
Andy_L_J5-Nov-08 1:36
Andy_L_J5-Nov-08 1:36 
QuestionError while executing Query Pin
praveenkumar_k4-Nov-08 20:50
praveenkumar_k4-Nov-08 20:50 
AnswerRe: Error while executing Query Pin
Wendelius5-Nov-08 10:43
mentorWendelius5-Nov-08 10:43 
Questionconnection string Pin
LiYS4-Nov-08 19:15
LiYS4-Nov-08 19:15 
AnswerRe: connection string Pin
Giorgi Dalakishvili4-Nov-08 20:05
mentorGiorgi Dalakishvili4-Nov-08 20:05 
GeneralRe: connection string Pin
LiYS4-Nov-08 20:18
LiYS4-Nov-08 20:18 
GeneralRe: connection string Pin
Giorgi Dalakishvili4-Nov-08 20:25
mentorGiorgi Dalakishvili4-Nov-08 20:25 
Questionget difference between two double precision columns Pin
kani984-Nov-08 12:36
kani984-Nov-08 12:36 
AnswerRe: get difference between two double precision columns Pin
Blue_Boy4-Nov-08 14:26
Blue_Boy4-Nov-08 14:26 
GeneralRe: get difference between two double precision columns Pin
kani984-Nov-08 17:52
kani984-Nov-08 17:52 
AnswerRe: get difference between two double precision columns Pin
Wendelius4-Nov-08 18:13
mentorWendelius4-Nov-08 18:13 
Questioncorrelated subselect Pin
Smithers-Jones4-Nov-08 0:30
Smithers-Jones4-Nov-08 0:30 
AnswerRe: correlated subselect [modified] Pin
Wendelius4-Nov-08 4:58
mentorWendelius4-Nov-08 4:58 
GeneralRe: correlated subselect Pin
Smithers-Jones4-Nov-08 8:07
Smithers-Jones4-Nov-08 8:07 
GeneralRe: correlated subselect Pin
Wendelius4-Nov-08 8:23
mentorWendelius4-Nov-08 8:23 
AnswerRe: correlated subselect Pin
Blue_Boy4-Nov-08 6:10
Blue_Boy4-Nov-08 6:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.