Jump to content

nomore_sr

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by nomore_sr

    sum

    Hi:I have this querySELECT SUM(Total) FROM CargoD Where Folio=100there are no records in the table "CargoD" Where Folio=100 and I get a null resulthow could I write the query in order to get 0 instead of null?Thanks!!
    This query
    SELECT IsNull(SUM(Total),0) FROM CargoD Where Folio=100

    will return 0 if there are no records and sum if sum is not null

  1. I have two Table : Student include field : ID ,NAme,classs an a Table :Point include ID ,Point, name,class . I want when Update a table ,exemple : Student then The table Point so-so updated!Please help me
    Hope this useful. I tried and it worked
    Create trigger St_update on Studentfor updateAs update Point set [iD]=(select [iD] from Inserted), [Name]=(select [Name] rom Inserted), Class=(select Class from Inserted) where [iD]=(select [iD] from Deleted)

    Your Student table should have primary key. In this case I chose ID as primary key

  2. Well, the first step is to select which fields you want (or use * for all of them). Your sql so far is:SELECT field1, field2,etc FROM table_nameORSELECT * FROM table_nameThen you have to make sure it is sorted correctly by using the order by command and then ASC or DESC for ascending or descending. As you want most recent first I think you should try DESC:SELECT * FROM table_name ORDER BY date_field DESCThen you want to limit the results to the first 8 rows so the LIMIT keyword seems a good one to use:SELECT * FROM table_name ORDER BY date_field DESC LIMIT 0,7This returns all rows between 0 and 7 (ie 8 rows). Don't forget that your first row is 0 (not 1).
    :) this's useful. Thank youAnother way to select the first 8 rows
    SELECT top 8 * FROM table_name ORDER BY date_field DESC

  3. its work..thank you so much...now i'm gonna encrypt it...so that other ppl won't see the password...
    Other ppl won't see the password if method="post" like this
    <form id="login" action="" method="post"  onsubmit="LogIn(); return false;">

    default method is post

×
×
  • Create New...