Jump to content

Mysql query help...


ajlisowski

Recommended Posts

I am simplifying a much larger issue to hopefully be able to get some insight on how best to accomplish my bigger task.

 

Basically I have two tables, they are identical. We will call them table A and table B. All Primary keys in table B exist in table A, but not all keys in A exist in B. Data associated with the keys of B will be slightly different then that of A.

 

I want to grab one set of data from A and B where if a key exists in B we use that, otherwise we use A.

 

 

In case your wondering why. Basically I have a system where users can modify data but it has to be approved before it can go live. And when said users view the data I want them to see their modified data if it exists, otherwise they see the default data.

 

 

Link to comment
https://forums.phpfreaks.com/topic/202842-mysql-query-help/
Share on other sites

The issue with joining that I see is that if I join I will have two results, one for each table. And in the end i need to sort by and paginate based on the results. So lets say I want to sort by price, id have a.price and b.price, one of which would be null, the other a value, how would I sort by both of them?

Link to comment
https://forums.phpfreaks.com/topic/202842-mysql-query-help/#findComment-1063040
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.