I have a DB with the following COLS
What i would like to do is to add the value of all the fee's rows but ignore the one that has Department in the user row.
any one able to assist me?
SELECT SUM(fee) AS total_fee
WHERE user <> 'Department'
It's simple.I need your tables structure. but I know you have to join tables like this:
SELECT * FROM fee LEFT JOIN user ON fee.user_id = user.id WHERE user.department;
This is the table layout
I can't understand what do you mean of "but ignore the one that has Department in the user row"?If you mean the rows that are not containing the "Department" string then you must use LIKE %Department% in your WHERE.
you skipped right over my earlier post, didn't you?
he gave the table layout in post #1, and i gave the obvious answer
turns out i was right, and the user table is not needed
well, i sympathize with these guys--bofadem--because they are probably young, inexperienced, and yet eager
never sell eagerness short, it is a valuable quality :award:
Yes r937, as you see in my next post, I couldn't understand exactly what he wants.Checking for a string in user row:
SELECT SUM(fee) AS total_fee FROM your_table WHERE user NOT LIKE '%Department%'
Rudy had already provided the answer before your original post. The second post in this thread provides a better answer than your latest answer.
massive thanks to all i've got it sorted !