Database query help

Discussion forum for MOD Writers regarding MOD Development.
Registered User
Posts: 1
Joined: Thu Oct 01, 2015 7:17 pm

Database query help

Post by popgammy » Thu Oct 01, 2015 7:25 pm


Can someone give me an example a query I would need in order to accomplish the following, I would like it in a single query if possible.

I have 2 tables: itemsforsale and itemsbought

When the user visits the page I want only to display products from itemsforsale that the user has not purchased already, doesn't exist in itemsbought.

So something like

Code: Select all

SELECT items FROM itemsforsale WHERE item-with-same-item DOES NOT EXIST in itemsbought WHERE user_id = user and item_id = itemsforsaleid
So basically just looping through the tables and only outputting itemforsale that don't exist in the itemsbought tablet for that specific user. :?

User avatar
Registered User
Posts: 5588
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン

Re: Database query help

Post by AmigoJack » Mon Oct 05, 2015 8:20 am

While the answer is quite simple I don't see what this has to do with phpBB at all. Also you didn't tell your DBMS - there might be a specific non ANSI-SQL slang that might be needed. And on top describe your tables. Not with words, of course - with CREATE TABLE...
The worst thing about censorship is ███████████
Affin wrote:
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
We will not come anybody anyway, nevertheless, it's best to shit this.


Return to “[3.0.x] MOD Writers Discussion”