473,396 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Join 3 tables display first record only

Could someone help me please I have three tables:

gallery
gallery_images
users

I am joining data from the three tables the problem is that there are multiple records that appear in the gallery_images that relate to one gallery record.
I need to display the first record only while joining the three tables.

This is the sql query so far:

SELECT * FROM gallery, gallery_images, users
WHERE gallery.guser = users.uid
AND users.uid = " & uid & "
AND gallery.gid = gallery_images.gid"

This will return the results for the three tables but how can I change to display the first record of the gallery_images table only.

Any help would be great thanks
Nov 30 '06 #1
1 4250
NeoPa
32,556 Expert Mod 16PB
Could someone help me please I have three tables:

gallery
gallery_images
users

I am joining data from the three tables the problem is that there are multiple records that appear in the gallery_images that relate to one gallery record.
I need to display the first record only while joining the three tables.

This is the sql query so far:

SELECT * FROM gallery, gallery_images, users
WHERE gallery.guser = users.uid
AND users.uid = " & uid & "
AND gallery.gid = gallery_images.gid"

This will return the results for the three tables but how can I change to display the first record of the gallery_images table only.

Any help would be great thanks
Try this and then try to explain clearly what you get and what you would prefer to get.
Expand|Select|Wrap|Line Numbers
  1. strSQL = "SELECT * " & _
  2.     "FROM (users INNER JOIN gallery " & _
  3.         "ON users.uid=gallery.guser) " & _
  4.         "INNER JOIN gallery_images " & _
  5.         "ON gallery.gid = gallery_images.gid" & _
  6.     "WHERE gallery.guser = " & uid
Nov 30 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: B. Fongo | last post by:
I learned MySQL last year without putting it into action; that is why I face trouble in formulating my queries. Were it a test, then you would have passed it, because your queries did help me...
2
by: Lyn | last post by:
Hi, I am opening a form in Continuous mode to list the records from a recordset created in the calling form. The recordset object is declared as Public and is set into the new form's Recordset...
7
by: Chris | last post by:
I'm using ASP.NET and SQL Server and this might be an obviuos question for most, but if I have a table that contains several fields that I need to relate to just one field in another table, how do...
2
by: JP2006 | last post by:
I have a situation where I have 2 tables - NODES and TAGS. Nodes is the main table and contains various columns one of which is tagID. Tags contains a list of tag names and tagIDs. When a user adds...
52
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible...
3
by: shawnews | last post by:
Ok...I'll first describe briefly what I've done. Working from a paper form with over 200 fields - broken into 10 areas, I created a database with 10 tables. I then created a form using those 10...
5
by: Bob Bridges | last post by:
Start with two tables, parent records in one and child records in the other, a one-to-many relationship. Create a select statement joining the two. Display the query in datasheet mode. When I...
3
by: Zeff | last post by:
Hi all, I have a relational database, where all info is kept in separate tables and just the id's from those tables are stored in one central table (tblMaster)... I want to perform a query, so...
4
by: beary | last post by:
Hi, I have 2 tables as follows: table1 (studid,studfirst,studlast) table2 (resid,studid,resnum,resgrade) In table 1 are 2 records: Record 1: '1','Michael','Jackson' Record 2:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.