Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20
  1. #11

    Quote Originally Posted by Cruzader View Post
    ^ La man pud labels ni
    Cebu |17000 |
    Davao |8000 |
    Manila | | 6000

    Unsao gud ng klarong output
    naa man bro, kanang naa sa babaw...
    branch| regular | contratual

  2. #12
    Another solution using unions and is more portable:
    Code:
    select branch, sum(basic_pay) as regular, sum(0) as contractual 
    	from salary where emp_status='regular' group by 1
    union all
    select branch, sum(0) as regular, sum(basic_pay) as contractual 
    	from salary where emp_status='contractual' group by 1

  3. #13
    Quote Originally Posted by cold_fusion View Post
    with mysql, you could do this:
    Code:
    select branch, 
        sum(if(emp_status='regular',basic_pay,0)) as regular,
        sum(if(emp_status='contrctual',basic_pay,0)) as contractual
        from salary
        group by 1
    thank you kaayo ani nga code boss, its working now....thanks again...

  4. #14
    You're welcome!

  5. #15

    Default Help: new query

    naa nasad ko i-inquire ninyo sir:
    customerNo | Lname | Fname| mInitial | address
    00001 | Ang | Vic | T | Cebu City
    00002 | Ballesteros | Tom | R | Talisay City
    00003 | Pino | Bing | C | Cebu City
    00004 | Sanchez | Lyn | V | Mandaue City
    00005 | Uy | Amy | A | Cebu City
    ang pangutana nako ani sir, if mag-query gani ko nga update murag ingon ani ba:
    if ni exist na ang iyang customerNo iya ra i-update ang tanang fields and if wala pa
    ni-exist kay iyang i-insert ang bag-o nga entry...

    situation1: naay bag-o nga entry nya naa lets say 00003, Rama, Bing, P , Davao City kani kay
    naa na man ang iyang customerNo iya ra i-update ang mga fields...
    situation2: 00010, Mersiditas, Melinda, C, Cebu City kani kay bag-o man ang iyang CustomrNo
    i-insert ni tanan

    thnx daan sir...

  6. #16
    Quote Originally Posted by rastaman81 View Post
    naa nasad ko i-inquire ninyo sir:
    customerNo | Lname | Fname| mInitial | address
    00001 | Ang | Vic | T | Cebu City
    00002 | Ballesteros | Tom | R | Talisay City
    00003 | Pino | Bing | C | Cebu City
    00004 | Sanchez | Lyn | V | Mandaue City
    00005 | Uy | Amy | A | Cebu City
    ang pangutana nako ani sir, if mag-query gani ko nga update murag ingon ani ba:
    if ni exist na ang iyang customerNo iya ra i-update ang tanang fields and if wala pa
    ni-exist kay iyang i-insert ang bag-o nga entry...

    thnx daan sir...
    Mura ra ug nag INSERT ka, peru imo gamiton kay REPLACE

    book definition is:
    REPLACE is exactly like INSERT, except that when MySQL encounters a record with a primary or unique key that already exists, it will be deleted and replaced.

  7. #17
    ^^^ wow nice ni nga command dah...very handy...naa ni xa nga command sa postgres bro?

  8. #18
    Quote Originally Posted by ingkiang View Post
    ^^^ wow nice ni nga command dah...very handy...naa ni xa nga command sa postgres bro?
    Check this out lang bro,

    Programming:Converting MySQL to PostgreSQL - Wikibooks, collection of open-content textbooks

  9. #19
    wala kaayo ko kakuha sa REPLACE sir,

    ani man gud na siya, java nga code nya galoop ni siya bali

    ang query ani niya condition gani nga if customerNo ni exists update lang if wala so insert:

    ang syntax unta ani nga flow akong gi-mean ani sir, sa MySQL

  10. #20
    Quote Originally Posted by rastaman81 View Post
    wala kaayo ko kakuha sa REPLACE sir,

    ani man gud na siya, java nga code nya galoop ni siya bali

    ang query ani niya condition gani nga if customerNo ni exists update lang if wala so insert:

    ang syntax unta ani nga flow akong gi-mean ani sir, sa MySQL
    post lang imo java code para ma klaro nato

  11.    Advertisement

Page 2 of 2 FirstFirst 12

Similar Threads

 
  1. MySQL Query Help : Foreign Keys
    By cjoyce12 in forum Programming
    Replies: 0
    Last Post: 01-06-2011, 06:57 PM
  2. i need ur help in query sa vb
    By skeptic_rob in forum Programming
    Replies: 15
    Last Post: 12-31-2010, 10:38 PM
  3. mysql help in outfile query
    By kurokotoque in forum Programming
    Replies: 1
    Last Post: 03-13-2009, 12:48 AM
  4. Need help MYSQL Query on dynamic table..
    By salbahis in forum Programming
    Replies: 6
    Last Post: 11-15-2008, 11:25 AM
  5. HELP! Conditional Statements in MYSQL
    By tynum in forum Programming
    Replies: 17
    Last Post: 10-06-2008, 04:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top