Jump to content

Order by date in multiple tables


ramli

Recommended Posts

I have four tables.

 

 

 

## Income ####################

#User ID |Number |UniqeID |date        #

#1        |300      |2        | 1-2-2006  #

#1        |          |3        | 1-3-2006  #

############################

 

// if number is empty

 

## Income items#################

#User ID |Number |UniqeID |date        #

#1        |400      |3        | 1-3-2006  #

#1        |244      |3        | 1-3-2006  #

############################

 

//////////////////////////////////////////////

 

## Outcome ###################

#User ID |Number |UniqeID |date        #

#1        |400      |2        | 1-2-2006  #

#1        |          |4        | 1-3-2006  #

############################

 

// if number is empty

 

## Outcome items ###############

#User ID |Number |UniqeID |date        #

#1        |400      |4        | 1-3-2006  #

#1        |200      |4        | 1-3-2006  #

############################

 

 

 

Desierd outcome:

 

# Type      # Number # UserID # date      #

# Outcome | 600      | 1        | 1-3-2006 #

# Income  | 644      | 1        | 1-3-2006 #

# Outcome | 400      | 1        | 1-2-2006 #

# Income  | 300      | 1        | 1-2-2006 #

##############################

 

Explaination:

 

Select in "outcome" and "income" the data and sort by "date" and display it. Next if in "income" there is no "number" present search in the table 'income items" for the same "uniqeID" and add them up to eachother and display it.

 

I have search several forums for the aswer i hope one of you can help me with this problem.

thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/48161-order-by-date-in-multiple-tables/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.