urtrivedi 276 Nearly a Posting Virtuoso
  1. What you are showing seems to be file upload part.
  2. File content function not visible in your script. i.e. move_uploaded_file() to be moved to your folder.
  3. Href link to download file can be rendered in html emebded with php loop of file table.

echo "<a href='http:domain/contentfolder/{$filename}' target='_blank'>download file here<a>";

urtrivedi 276 Nearly a Posting Virtuoso

1 use bootstrap css or any other you know for row hover
https://www.w3schools.com/bootstrap/bootstrap_tables.asp

2 put your table under < form > tag
Add one more th/td in header and whole loop.
..
.
.
<th width="5">select row</th>
<th width="5">ID</th>
.
.
While..
..
.
.
echo '<td><input type=radio name =selrow value='.$row['id'].' ></td>'.echo '<td>'.$row['id'].'</td>'
...
.
.

Greg_11 commented: Thank-You very much, got me on the right track and I now have a working selectable table/form +0
urtrivedi 276 Nearly a Posting Virtuoso

Dear larry
You need not to have two triggers. Only before insert trigger is fine.

urtrivedi 276 Nearly a Posting Virtuoso

specify column names as shown in following query. Make sure you spell column right as its in your table. There are more columns in your table then in your $variable list (line 41).

$sql = "INSERT INTO `User` (firstname,lastname, addresslin1, addresslin2, postcode,city, email,password,dttime, verificationcode, status)".
           " values ".
           "('$FirstName', '$LastName', '$AddressLine1', '$AddressLine2', '$PostCode', '$City', '$Email', '$Password', NOW(), '$verificationCode', '0' )";
urtrivedi 276 Nearly a Posting Virtuoso

Yes exactly put line 17-18 inside while loop.

urtrivedi 276 Nearly a Posting Virtuoso

Before line number 100 that is before ending while loop break the loop

break;
} //end of while

OR
fix the while loop query code (LINE 21), it is giving more then one record i guess.
OR
If you generating mulitple files, then intialise excel object inside while loop and after generating file, destroy it before while loop ends.

urtrivedi 276 Nearly a Posting Virtuoso
select concat(username,'@irma.ac.in') as email from student
urtrivedi 276 Nearly a Posting Virtuoso

no utf encode is needed in php
just data base column in mysql need to be utf8_unicode_ci

urtrivedi 276 Nearly a Posting Virtuoso

try to change collation to utf8_general_ci of the column where you store your malyalam content

urtrivedi 276 Nearly a Posting Virtuoso

Run query in phpmyadmin

select date_format(p_date,'%b-%Y'), user_id
, sum( if(str_to_date(concat(p_date,' ',timein),'%Y-%m-%d %H:%i:%s') > str_to_date(concat(p_date,' ',clock_in_eve),'%Y-%m-%d %H:%i:%s') ,1,0)) late_days
     from presence
group by date_format(p_date,'%b-%Y'), user_id having late_days>0
order by date_format(p_date,'%b-%Y'), user_id
urtrivedi 276 Nearly a Posting Virtuoso

1) both are different

2) one is $username is local page variable and $_SESSION['username'] is a session variable and its an array too.

3) even $UserName, $userName, $_SESSION['uSERnAME'], $_SESSION['UserName'] all are different as php is case sensitive

4) any $_SESSION variable is available globally across all pages if you start your page with session_start(); function

5) other variables stay live for that particular page only

urtrivedi 276 Nearly a Posting Virtuoso
echo "<input type='checkbox' name='date' value ='".date('d-m-Y', $date)."'>";
urtrivedi 276 Nearly a Posting Virtuoso
urtrivedi 276 Nearly a Posting Virtuoso

put follwing after line 31 and before line 32

if( $x < count($files) - 1 )
urtrivedi 276 Nearly a Posting Virtuoso

Change following
Line 21

$sql="SELECT username FROM admin WHERE username='".$myusername."' AND password='".$mypassword."'";

Line 25

if($row[0]!="")
urtrivedi 276 Nearly a Posting Virtuoso

run this query in phpymyadmin for whom you are clicking on name link
and see how dob column appears in phpmyadmin result

SELECT * FROM contact1 WHERE contact_id = yournumber
urtrivedi 276 Nearly a Posting Virtuoso

Now run combined version

If still record do not appear properly, then check spellings of values in all join columns

SELECT
c.contact_id,c.fullname,
s.spouse_id,s.s_fullname,s.sspouse_name,
ch.child_id,ch.c_fullname,ch.primaryparent,ch.secondaryparent
FROM contact1 c
left outer JOIN spouse1 s ON trim(c.fullname) = trim(s.sspouse_name)
LEFT JOIN child1 ch ON trim(c.fullname) = trim(ch.primaryparent)
urtrivedi 276 Nearly a Posting Virtuoso

Try with left outer join, and check whats missing

SELECT
c.contact_id,c.fullname,
s.spouse_id,s.s_fullname,s.sspouse_name,
ch.child_id,ch.c_fullname,ch.primaryparent,ch.secondaryparent
FROM contact1 c
left outer JOIN spouse1 s ON c.fullname = s.sspouse_name
LEFT JOIN child1 ch ON c.fullname = ch.primaryparent

Or check with trim

SELECT
c.contact_id,c.fullname,
s.spouse_id,s.s_fullname,s.sspouse_name,
ch.child_id,ch.c_fullname,ch.primaryparent,ch.secondaryparent
FROM contact1 c
INNER JOIN spouse1 s ON trim(c.fullname) = trim(s.sspouse_name)
LEFT JOIN child1 ch ON trim(c.fullname) = trim(ch.primaryparent)

But I feel table is not properly design. Joining on name is not a good idea

urtrivedi 276 Nearly a Posting Virtuoso
<?php
$text1 = '00101';
echo "<br>$text1 -> Count 0 from begining (zeroth character) : ".substr_count($text1, '0'); 
echo "<br>$text1 -> Count 0 start after zeroth character : ".substr_count($text1, '0',1); 


?>

http://www.php.net/manual/en/function.substr-count.php

urtrivedi 276 Nearly a Posting Virtuoso

How about this

$query = "Select coach_career.coach_career_id, coach_career.pid, coach_career.league_id, coach_career.club_id, coach_career.season, coach_career.pos, coach_career.games, coach_career.wins, coach_career.losses, coach_career.draws, coach_career.fingames, coach_career.finwins, coach_career.finlosses, coach_career.findraws, coach_career.gfgames, coach_career.gfwins, coach_career.gflosses, coach_career.gfdraws, coach_career.totgames, coach_career.totwins, coach_career.totlosses, coach_career.totdraws, coach_career.win_ratio, club.club, league.league From coach_career Inner Join club ON coach_career.club_id = club.club_id Inner Join league ON coach_career.league_id = league.league_id Where coach_career.pid = '$pid' Order By league.league,coach_career.season Asc, coach_career.league_id Asc";
$statement = $databaseConnection->prepare($query);
$statement->execute();
$statement->store_result();
$statement->bind_result($coach_career_id, $pid, $league_id, $club_id, $season, $pos, $games, $wins, $losses, $draws, $fingames, $finwins, $finlosses, $findraws, $gfgames, $gfwins, $gflosses, $gfdraws, $totgames, $totwins, $totlosses, $totdraws, $win_ratio, $club, $league);
if ($statement->error) {
die('Database query failed: ' . $statement->error);
}
$Exists = $statement->num_rows > 0;
if ($Exists) {

$alternate = "1"; 
$prevleague="";
$rownumber=0;
while ($statement->fetch()) {
    if ($alternate == "1") { 
        $tbrow = "tbrow2"; 
        $alternate = "2"; 
    } else { 
        $tbrow = "tbrow1"; 
        $alternate = "1"; 
    }

    if($rownumber>0 && $prevleague!=$league)
    {
        echo $sumhtml;
        echo "</table>";
    }



    if($prevleague!=$league)
    {
        echo"<br /></br><table width=\"98%\"><caption>$league</caption>";
echo"<tr><th width=\"31%\" colspan=\"4\">Coaching Career</th><th width=\"16%\" colspan=\"4\"><center>Home & Away</center></th><th width=\"16%\" colspan=\"4\"><center>Finals</center></th><th width=\"16%\" colspan=\"4\"><center>Grand Finals</center></th><th width=\"16%\" colspan=\"4\"><center>Total Games</center></th><th colspan=\"2\"></th></tr>";
echo"<th class=\"category\" width=\"4%\"><center>Year</center></th><th class=\"category\" width=\"10%\">League</th><th class=\"category\" width=\"10%\">Club</th><th class=\"category\" width=\"3%\"><center>Pos</center></th><th class=\"category\" width=\"3%\"><center>Gms</center></th><th class=\"category\" width=\"3%\"><center>W</center></th><th class=\"category\" width=\"3%\"><center>L</center></th><th class=\"category\" width=\"3%\"><center>D</center></th><th class=\"category\" width=\"3%\"><center>Gms</center></th><th class=\"category\" width=\"3%\"><center>W</center></th><th class=\"category\" width=\"3%\"><center>L</center></th><th class=\"category\" width=\"3%\"><center>D</center></th><th class=\"category\" width=\"3%\"><center>Gms</center></th><th class=\"category\" width=\"3%\"><center>W</center></th><th class=\"category\" width=\"3%\"><center>L</center></th><th class=\"category\" width=\"3%\"><center>D</center></th><th class=\"category\" width=\"3%\"><center>Gms</center></th><th class=\"category\" width=\"3%\"><center>W</center></th><th class=\"category\" width=\"3%\"><center>L</center></th><th class=\"category\" width=\"3%\"><center>D</center></th><th class=\"category\"width=\"5%\"><center>Edit</center></th><th class=\"category\"width=\"5%\"><center>Del</center></th>";


  $query = "Select Sum(coach_career.games) AS sumgames, Sum(coach_career.wins) AS sumwins, Sum(coach_career.losses) AS sumlosses, Sum(coach_career.draws) AS sumdraws, Sum(coach_career.fingames) AS sumfingames, Sum(coach_career.finwins) AS sumfinwins, Sum(coach_career.finlosses) AS sumfinlosses, Sum(coach_career.findraws) AS sumfindraws, Sum(coach_career.gfgames) AS sumgfgames, Sum(coach_career.gfwins) AS sumgfwins, Sum(coach_career.gflosses) AS sumgflosses, Sum(coach_career.gfdraws) AS sumgfdraws, Sum(coach_career.totgames) AS sumtotgames, …
urtrivedi 276 Nearly a Posting Virtuoso

forget it

please check following works or not

I have put your new summation code before closing table tag

$query = "Select coach_career.coach_career_id, coach_career.pid, coach_career.league_id, coach_career.club_id, coach_career.season, coach_career.pos, coach_career.games, coach_career.wins, coach_career.losses, coach_career.draws, coach_career.fingames, coach_career.finwins, coach_career.finlosses, coach_career.findraws, coach_career.gfgames, coach_career.gfwins, coach_career.gflosses, coach_career.gfdraws, coach_career.totgames, coach_career.totwins, coach_career.totlosses, coach_career.totdraws, coach_career.win_ratio, club.club, league.league From coach_career Inner Join club ON coach_career.club_id = club.club_id Inner Join league ON coach_career.league_id = league.league_id Where coach_career.pid = '$pid' Order By league.league,coach_career.season Asc, coach_career.league_id Asc";
$statement = $databaseConnection->prepare($query);
$statement->execute();
$statement->store_result();
$statement->bind_result($coach_career_id, $pid, $league_id, $club_id, $season, $pos, $games, $wins, $losses, $draws, $fingames, $finwins, $finlosses, $findraws, $gfgames, $gfwins, $gflosses, $gfdraws, $totgames, $totwins, $totlosses, $totdraws, $win_ratio, $club, $league);
if ($statement->error) {
die('Database query failed: ' . $statement->error);
}
$Exists = $statement->num_rows > 0;
if ($Exists) {

$alternate = "1"; 
$prevleague="";
$rownumber=0;
while ($statement->fetch()) {
    if ($alternate == "1") { 
        $tbrow = "tbrow2"; 
        $alternate = "2"; 
    } else { 
        $tbrow = "tbrow1"; 
        $alternate = "1"; 
    }

    if($rownumber>0 && $prevleague!=$league)
    {



        $query = "Select Sum(coach_career.games) AS sumgames, Sum(coach_career.wins) AS sumwins, Sum(coach_career.losses) AS sumlosses, Sum(coach_career.draws) AS sumdraws, Sum(coach_career.fingames) AS sumfingames, Sum(coach_career.finwins) AS sumfinwins, Sum(coach_career.finlosses) AS sumfinlosses, Sum(coach_career.findraws) AS sumfindraws, Sum(coach_career.gfgames) AS sumgfgames, Sum(coach_career.gfwins) AS sumgfwins, Sum(coach_career.gflosses) AS sumgflosses, Sum(coach_career.gfdraws) AS sumgfdraws, Sum(coach_career.totgames) AS sumtotgames, Sum(coach_career.totwins) AS sumtotwins, Sum(coach_career.totlosses) AS sumtotlosses, Sum(coach_career.totdraws) AS sumtotdraws From coach_career Where coach_career.pid = ? AND coach_career.league_id = ?";
        $statement2 = $databaseConnection->prepare($query);
        $statement2->bind_param('ii', $pid, $league_id);
        $statement2->execute();
        $statement2->store_result();
        if ($statement2->error) {
            die('Database query failed: ' . $statement2->error);
        }
        $statement2->bind_result($sumgames, $sumwins, $sumlosses, $sumdraws, $sumfingames, $sumfinwins, $sumfinlosses, $sumfindraws, $sumgfgames, $sumgfwins, $sumgflosses, $sumgfdraws, $sumtotgames, $sumtotwins, $sumtotlosses, $sumtotdraws);
        $statement2->fetch(); …
urtrivedi 276 Nearly a Posting Virtuoso

To avoid complexity, You may also try with another approach

1) query list distinct leagus of partiular pid

2) loop through leagues found above

2.1) find deatils of coaching for pid for all leages on by one

    2.1.1) loop through details of coaching

2.2) here at the end you can show sum of coaching detail rows

3) if any more league left then go to step 2 else end

urtrivedi 276 Nearly a Posting Virtuoso

Kindly check following works or not
I have added league in order by and bring table heading rows inside loop with conditions

$query = "Select coach_career.coach_career_id, coach_career.pid, coach_career.league_id, coach_career.club_id, coach_career.season, coach_career.pos, coach_career.games, coach_career.wins, coach_career.losses, coach_career.draws, coach_career.fingames, coach_career.finwins, coach_career.finlosses, coach_career.findraws, coach_career.gfgames, coach_career.gfwins, coach_career.gflosses, coach_career.gfdraws, coach_career.totgames, coach_career.totwins, coach_career.totlosses, coach_career.totdraws, coach_career.win_ratio, club.club, league.league From coach_career Inner Join club ON coach_career.club_id = club.club_id Inner Join league ON coach_career.league_id = league.league_id Where coach_career.pid = '$pid' Order By league.league,coach_career.season Asc, coach_career.league_id Asc";
$statement = $databaseConnection->prepare($query);
$statement->execute();
$statement->store_result();
$statement->bind_result($coach_career_id, $pid, $league_id, $club_id, $season, $pos, $games, $wins, $losses, $draws, $fingames, $finwins, $finlosses, $findraws, $gfgames, $gfwins, $gflosses, $gfdraws, $totgames, $totwins, $totlosses, $totdraws, $win_ratio, $club, $league);
if ($statement->error) {
die('Database query failed: ' . $statement->error);
}
$Exists = $statement->num_rows > 0;
if ($Exists) {

$alternate = "1"; 
$prevleague="";
$rownumber=0;
while ($statement->fetch()) {
    if ($alternate == "1") { 
        $tbrow = "tbrow2"; 
        $alternate = "2"; 
    } else { 
        $tbrow = "tbrow1"; 
        $alternate = "1"; 
    }

    if($rownumber>0 && $prevleague!=$league)
    {
        echo "</table>";
    }
    if($prevleague!=$league)
    {
        echo"<br /></br><table width=\"98%\"><caption>$league</caption>";
echo"<tr><th width=\"31%\" colspan=\"4\">Coaching Career</th><th width=\"16%\" colspan=\"4\"><center>Home & Away</center></th><th width=\"16%\" colspan=\"4\"><center>Finals</center></th><th width=\"16%\" colspan=\"4\"><center>Grand Finals</center></th><th width=\"16%\" colspan=\"4\"><center>Total Games</center></th><th colspan=\"2\"></th></tr>";
echo"<th class=\"category\" width=\"4%\"><center>Year</center></th><th class=\"category\" width=\"10%\">League</th><th class=\"category\" width=\"10%\">Club</th><th class=\"category\" width=\"3%\"><center>Pos</center></th><th class=\"category\" width=\"3%\"><center>Gms</center></th><th class=\"category\" width=\"3%\"><center>W</center></th><th class=\"category\" width=\"3%\"><center>L</center></th><th class=\"category\" width=\"3%\"><center>D</center></th><th class=\"category\" width=\"3%\"><center>Gms</center></th><th class=\"category\" width=\"3%\"><center>W</center></th><th class=\"category\" width=\"3%\"><center>L</center></th><th class=\"category\" width=\"3%\"><center>D</center></th><th class=\"category\" width=\"3%\"><center>Gms</center></th><th class=\"category\" width=\"3%\"><center>W</center></th><th class=\"category\" width=\"3%\"><center>L</center></th><th class=\"category\" width=\"3%\"><center>D</center></th><th class=\"category\" width=\"3%\"><center>Gms</center></th><th class=\"category\" width=\"3%\"><center>W</center></th><th class=\"category\" width=\"3%\"><center>L</center></th><th class=\"category\" width=\"3%\"><center>D</center></th><th class=\"category\"width=\"5%\"><center>Edit</center></th><th class=\"category\"width=\"5%\"><center>Del</center></th>";
    }

    echo"<tr><td width=\"4%\" class=\"$tbrow\"><center>$season</center></td><td width=\"10%\" class=\"$tbrow\">$league</td><td width=\"10%\" class=\"$tbrow\">$club</td><td width=\"3%\" class=\"$tbrow\"><center>$pos</center></td><td width=\"3%\" class=\"$tbrow\"><center>$games</center></td><td width=\"3%\" class=\"$tbrow\"><center>$wins</center></td><td width=\"3%\" class=\"$tbrow\"><center>$losses</center></td><td width=\"3%\" class=\"$tbrow\"><center>$draws</center></td><td width=\"3%\" class=\"$tbrow\"><center>$fingames</center></td><td width=\"3%\" class=\"$tbrow\"><center>$finwins</center></td><td width=\"3%\" class=\"$tbrow\"><center>$finlosses</center></td><td …
urtrivedi 276 Nearly a Posting Virtuoso

so on the top of table, you want to show league name, and details will follow right?

urtrivedi 276 Nearly a Posting Virtuoso

I dont think when you add records then you need to create separate code for new records.

League_id is from another table wich is likely to be added to over time I would have to cintinually update the page adding extra code and queries every time. Is there a way I can code this to display them otherwise.

Can you post another piece of code that you modify and for new league added, so that we can compare your code and give suggestions

urtrivedi 276 Nearly a Posting Virtuoso

your method is post (see line no. 3) so changed line number 49,50

$myusername=mysqli_real_escape_string($con,$_POST['name']); 
$mypassword=mysqli_real_escape_string($con,$_POST['password']); 

change line 62 (if $row[0] has some value of id, means not blank)

if($row[0]!="")
urtrivedi 276 Nearly a Posting Virtuoso

I am writing sample query

select a.id_customer, b.firstname,b.lastname, count(*) total_orders from orders a inner join customer b on a.id_customer=b.id_customer group by a.id_customer b.firstname,b.lastname
urtrivedi 276 Nearly a Posting Virtuoso

put all require php in the begning of page together, with out any line or space

also include phpgraphlib.php in the begninng too

urtrivedi 276 Nearly a Posting Virtuoso

You need to put whole code here
so that we can find problem

urtrivedi 276 Nearly a Posting Virtuoso

I changed your if condition at line 22 , if row count == 0 then means record does not exists with number, so show insert when $row[0]==0 , otherwise show "already exits" message

   if ($row[0] == 0)
urtrivedi 276 Nearly a Posting Virtuoso

Use following clause update when duplicate

http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html

urtrivedi 276 Nearly a Posting Virtuoso

I assume your database is mysql

select str_to_date(string_date_col, '%M %d, %Y') from tblTransaction

Str_to_date function will change string to date type

http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_str-to-date

diafol commented: snap! +0
urtrivedi 276 Nearly a Posting Virtuoso

I hope this may help you. You can do that using css

http://www.w3schools.com/css/css_mediatypes.asp

urtrivedi 276 Nearly a Posting Virtuoso

I am changing 4 lines of your student_login_handler.php

Line 7

$query = "select student_id,last_login_date from student_information where learner_id='$learner_id' and student_password='$student_password'";

Line 16

$_SESSION['user_id'] = $date['student_id'];

Line 19

mysql_query("UPDATE student_information SET last_login_date=now() where student_id='{$_SESSION['user_id']}'",$link_id);

Line 23

header("location:  Student_Home.php?id={$_SESSION['user_id']}"); 
urtrivedi 276 Nearly a Posting Virtuoso
SELECT * FROM `users` WHERE 
(
uid  not in (select friend_two from friends where friend_one='$uid' ) 
and
uid not in (select friend_one from friends where friend_two='$uid' ) 
)
urtrivedi 276 Nearly a Posting Virtuoso

post your structure and sample data here

urtrivedi 276 Nearly a Posting Virtuoso

I guess problem is in your join

LEFT JOIN friends F ON U.uid=F.friend_one

You already joing uid with freind one , with that query you willl never receive result.

can you post both sample table script and sample data here or at http://sqlfiddle.com/

urtrivedi 276 Nearly a Posting Virtuoso

I guess sublime text is just an editor with good features for progammers. But any simple notepad is enough to write php code.

create text file name it as HelloWorld.php (or any name with extension as php)
open it and write following code

    <?php
    echo "this is php code";
    echo "Hello world";

    ?>
<h1> This is html code </h1>

<h2 > this is <?php echo "php embeded in html"; ?> </h2>

Save that file in your web root directory and open it with appropriate location in any browser.

url : http://localhost/anyfolder/anysubfolder/HelloWorld.php

urtrivedi 276 Nearly a Posting Virtuoso

Try to Use distinct keyword in your query

$dropdownquery="select distinct col1,col2 ....";
urtrivedi 276 Nearly a Posting Virtuoso

We use explode fuction with seperator / , so it will give you array of size 3, then you can concate it as shown below

$datearr=explode("/",$myDate);
$dbdate=$datearr[2]."-".$datearr[0]."-".$datearr[1];
urtrivedi 276 Nearly a Posting Virtuoso

I have changed your first query
1) added 2 columns in group by
2) added where clause according to your second query

$sql = "select id,date,category,sum(q1) Total,sum(q2) Total2,sum(q3) Total3,sum(q4) Total4,sum(q5) Total5,sum(q6) Total6 from articles WHERE from_date >= '".mysql_real_escape_string($_REQUEST["from"])."' AND to_date <= '".mysql_real_escape_string($_REQUEST["to"])."'".$search_string.$search_city."  group by category order by id, date,category ";
urtrivedi 276 Nearly a Posting Virtuoso

try following as i suggested before

where f.friend_two <> '$uid' and F.friend_one <> '$uid'
urtrivedi 276 Nearly a Posting Virtuoso

To get correct result
1) I think you need to join clause to join users U, friends F
2) need to put where f.friend_two <> '$uid' and F.friend_one <> '$uid'

urtrivedi 276 Nearly a Posting Virtuoso

Your requirement is just grouping, its does not look like tree

You can do this using two queries

$cityquery= "select distinct city from usertable"
loop -- through above records and in loop fetch users for the city
echo $cityrow['city']
$userquery "select usernaem from usertable where city='{$cityrow['city']}'";

loop
   echo "&nbsp;&nbsp;&nbsp;".$userrow['userid'];
end loop

end loop ---city

urtrivedi 276 Nearly a Posting Virtuoso
echo array_sum($points)/count($points);
tapananand commented: I didn't know there is a function to calculate sum of array as well. PHP just doesn't want us to do anything. +2
urtrivedi 276 Nearly a Posting Virtuoso
SELECT cashid, sum(ramt) ramt, sum(pamt)pamt, ifnull(sum(ramt), 0)-ifnull(sum(pamt), 0) balance
  FROM (
    SELECT cashid, sum(amt) AS ramt, NULL AS pamt
      FROM receipt WHERE cashid IN ('17','23') GROUP BY cashid
  UNION ALL
    SELECT cashid, NULL AS ramt, sum(amt) AS pamt
      FROM payment WHERE cashid IN ('17','23') GROUP BY cashid)
AS bal

GROUP BY cashid
urtrivedi 276 Nearly a Posting Virtuoso

I am looking into it

urtrivedi 276 Nearly a Posting Virtuoso
select cashid, ramt, pamt, ifnull(ramt,0)-ifnull(pamt,0) balance from (
select cashid, sum(amt) as ramt, NULL AS pamt from receipt where cashid in ('17', '23') GROUP BY cashid
    union all
select cashid, NULL AS ramt, sum(amt) as pamt from payment where cashid in ('17', '23') GROUP BY cashid
)
group by cashid
urtrivedi 276 Nearly a Posting Virtuoso

What diafol suggested looks like the best possible solution.

urtrivedi 276 Nearly a Posting Virtuoso

ever changing means what,

how frequently columns sequence changed?
hourly, daily, weekly , monthly ???