Query help

Results 1 to 2 of 2

Thread: Query help

  1. #1
    Join Date
    Dec 1969

    Default Query help

    I need help in writing query <BR>I have a table tbl_temp which has sample data as below:<BR><BR>SizeID &#124 vALUE<BR>-----------------------<BR>1 &#124 1000<BR>2 &#124 8689<BR>3 &#124 9876<BR>4 &#124 5000<BR>-----------------------<BR><BR>I am getting two values from the querysting of the posted data.. for exapmle I might get Old=Request("old") which has a value of =0 <BR>and new= request("new") which has a value of = 1<BR><BR>&#039;Old&#039; and &#039;New &#039; refer to the SizeID in the above table . Even though SizeID =0 dosent exist Iam getting old=0 but that is not an issue .<BR><BR>I want to write a query on tbl_temp such that I get the result as below<BR><BR>OLDValue &#124 NEWValue<BR><BR>NULL &#124 1000 <BR>-----------------------------------<BR><BR>OldValue field dosent have any value because there is no value corresponding to sizeid=0 in the tbl_temp. newvalue has value of 1000 because sizeid 1 has a value of 1000<BR><BR><BR><BR>any help?<BR>Thanks,<BR>Ken<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Query help

    what db???<BR><BR>if SQL then:<BR><BR>Select<BR>OldValue = (select value from tbl_temp where sizeId = @oldId),<BR>NewValue = (select value from tbl_temp where sizeId = @newId)<BR><BR>Sponge

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts