If this is your first visit, check our documentation. To post, register or login.
Forums / Setting Up Your Zen Cart Products / Setting Up Specials and SaleMaker / Quick help with MySQL Query - Selecting OLD Product at Random

Quick help with MySQL Query - Selecting OLD Product at Random

Started by jeff_mash on 17 Nov 2015, 10:40 PM · Views: 9,283

Results 21 to 22 of 22
23 Nov 2015, 10:23 PM
#21
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #21 by drbyte

Jeff_Mash:

However, when I request to return other information (like the product NAME, the product IMAGE, things that I need for my other function), then the results returned give me some duplicates.Your duplicates are because you're joining multiple tables but not accounting for mismatched joins.
I built my suggestions based on you saying you wanted product_ids. Not complete product details. I assumed since you were only returning 1 item in your examples that you were intending to do a separate query for the rest of any truly needed data.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

23 Nov 2015, 11:05 PM
#22
jeff_mash avatar

jeff_mash

Totally Zenned

Join Date:
Aug 2004
Posts:
745
Plugin Contributions:
0

Post #22 by jeff_mash

DrByte:

Your duplicates are because you're joining multiple tables but not accounting for mismatched joins.
I built my suggestions based on you saying you wanted product_ids. Not complete product details. I assumed since you were only returning 1 item in your examples that you were intending to do a separate query for the rest of any truly needed data.

I understand, and THANK YOU for the help. I hope my previous reply didn't insinuate that your query was not what I has asked for. I simply used that as a "base" to modify and add more parameters to return fields from the database (like product name, image, etc). That was when I noticed it wasn't as easy as asking for those fields in the query.

  • Jeff