Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.