Results 1 to 6 of 6

Thread: Sql query untuk A+B-C ...

  1. #1
    Join Date
    Oct 2004
    Location
    ktn
    Posts
    8
    Rep Power
    0

    Sql query untuk A+B-C ...

    Aku ade 2 table dalam 1 database mysql sebagai contoh

    Table1
    - fieldA
    - fieldB

    Table2
    - sum(fieldC)

    Jadi macamana nak query angka dalam fieldA + fieldB - sum(fieldC)

    Terima kasih

  2. #2
    Join Date
    Apr 2002
    Location
    kuantan, pahang
    Posts
    58
    Rep Power
    213
    Select (table1.fieldA+table1.fieldB-sum(table2.fieldc))
    AS jumlah FROM table1,table2

  3. #3
    Join Date
    Oct 2004
    Location
    ktn
    Posts
    8
    Rep Power
    0
    Terima kasih Gemp-X

    Sql tu ok apabila dalam senarai saye ade 1 item je apabila dalam senarai ade lebih dari 1 item sql tu tak menjadik ahhh...
    Mungkin kena tambah filter kot tapi macamana ehh sebab saye ni masih baru lagi dalam sql ni ...

    Harap tolong ye... terima kasih

  4. #4
    Join Date
    Apr 2002
    Location
    kuantan, pahang
    Posts
    58
    Rep Power
    213
    eh sori, terkurang.. camni
    kat table1 tu tambah satu field primary key id (integer, auto_increment)

    Select (table1.fieldA+table1.fieldB-sum(table2.fieldC))
    AS jumlah FROM table1,table2 GROUP BY table1.id

    dengan tambah primary key id tu & GROUP BY id, dia akan return bilangan row ikut setiap id, kalo tak, memang error la kalo ade lebih dari 1 rekod.

    **off topic, tak berkenaan dgn yg ni.aku pelik la, apsal asal ade org tanye je, ade je yang menjawab..cari la kat google, banyak script [ fullstop], of course la banyak script, kurang2 bagi la hint..keyword ke, URL ke.. kalo tak tau, cakap je la tak tau jangan pandai2.kecuali la kalo soalan 2 soalan yg org da biase sangat tanye, mcm, cmne nk buat website, cmne nk blaja PHP, tolong aku!!! etc..kalo semua soalan dijawab 'cari kat google' tak guna la ber forum ni kan ?any arqument
    Last edited by Gemp-X; 05-10-2004 at 04:20 PM.

  5. #5
    Join Date
    Sep 2004
    Location
    Shah Alam
    Posts
    68
    Rep Power
    185
    ** off topic **
    saya sokong... apa guna bukak forum kalau takleh bertanya.. mungkin diorg pasai php dah terer cuma skang nie kena belajar bab etika plak kot...

  6. #6
    Join Date
    Oct 2004
    Location
    ktn
    Posts
    8
    Rep Power
    0
    Jadik aahh ...

    terima kasih pada anda semua kerana sudi menolong

    ** off topic **
    manusia ni ade banyak ragam usah peduli ... teruskan niat baik kita

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Query Vs Array
    By semutpower in forum Website Programming
    Replies: 2
    Last Post: 30-01-2009, 02:44 PM
  2. Need help : send & query image in php
    By mimosa in forum Website Programming
    Replies: 11
    Last Post: 04-11-2007, 11:53 PM
  3. Why my Query Not Working??
    By marukochan in forum Website Programming
    Replies: 3
    Last Post: 05-04-2007, 02:10 PM
  4. Help in query..
    By sweets in forum Website Programming
    Replies: 10
    Last Post: 27-03-2007, 10:39 AM
  5. how to secured query string
    By vash in forum Website Programming
    Replies: 3
    Last Post: 28-04-2004, 02:47 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
  •  

Search Engine Optimization by vBSEO 3.5.0 RC1 PL1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37