close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Help with SQL query

Thread began 12/19/2013 8:53 am by iainmacdonald331081 | Last modified 12/19/2013 11:20 am by Jason Byrnes | 292 views | 2 replies |

iainmacdonald331081

Help with SQL query

I have a table structure with queries that work on website, but would like to export some content out directly from the database. (So its a bit more complicated as it doesn't have a revision details page already pulling through a single record's details.

The table structure is:

Table: Revision

RevisionID
Revision
Status
etc

1, Delete Museum, 2 etc

Table: Profiles

ProfileID
Profile
Profile_Category
Category_Order

1, Museums, Places of Interest, 2 etc

Interlinking Table: revisionProfiles

ProfileID
RevisionID

1, 1

What I'm looking for in my query is all the fields from the Revision table plus the Profile field from the Profiles table, e.g.

1, Delete Museum, Museums

WHERE Revision.Status = 2 AND Category_Order = 2

There are a few Profile_Categories but for this category there will only ever be one Profile for any given Revision, e.g. Museums.

I've been playing around with it, but not sure of the syntax as there will be joins, and WHERE criteria from two of the tables involved.

Hope that makes sense.

Thanks.

Sign in to reply to this post

iainmacdonald331081

Just to say I got it:

SELECT *
FROM revision AS r
INNER
JOIN revisionProfiles AS rp
ON rp.RevisionID = r.RevisionID
INNER
JOIN profiles AS p
ON p.ProfileID = rp.ProfileID
AND p.Category_Order = 2
WHERE r.Status = 2

Sign in to reply to this post

Jason ByrnesWebAssist

Glad to hear you found the answer.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...