Displaying data from tables

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Displaying data from tables

Post by aceconcepts »

Hi,

I have a table called tblRegistration and another table called tblDownloadedRegistrations.

tblRegistration contains a list of ALL registrations and tblDownloadedRegistrations will contain all registrations that are downloaded.

Registrations are not moved from tblRegistration to tblDownloadedRegistrations but the unique key is used as a foreign key to reference each record.

When new registrations are added to tblRegistration and have not yet been downloaded I want to be able to display them in a list. How do I do this using SQL so that only the new registrations appear and not the downloaded ones? - I don't know the correct SQL syntaxt for this.

I hope this is clear. Thanks.
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

Re: Displaying data from tables

Post by ddragas »

if I understud your problem

try using query like

Code: Select all

 
 
select * from tblRegistration where tblRegistration.id not in (select tblRegistration_id from tblDownloadedRegistrations)
 
 
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Re: Displaying data from tables

Post by aceconcepts »

ddragas, you understood my problem perfectly. Thank you so much - works like a charm :D
Post Reply