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

echo Name not ID along with other sql statement.

Thread began 9/19/2011 8:56 am by Jon Cunningham | Last modified 9/20/2011 9:52 am by Jon Cunningham | 679 views | 2 replies |

Jon CunninghamBeta Tester

echo Name not ID along with other sql statement.

I have been working on a number of sites trying to get my old head around Sql Statements and have run into a issue when trying to combine some sql statements.

Echoing Name instead of ID i have worked out using the folowing code

SELECT Vehicle.*, manufacturer.VehicleManufacturerName
FROM Vehicle INNER JOIN manufacturer ON Vehicle.VehicleManufacturerID = manufacturer.VehicleManufacturerID
WHERE VehicleID = ParamVehicleID OR ( -1= ParamVehicleID2 AND VehicleID= ParamSessionVehicleID)

and i have worked out how to show 1 vehicle for the Car of the Week using the following statement

SELECT *
FROM vehicle
WHERE vehicle.VehicleCotw = 1
ORDER BY vehicle.VehicletUpdateDate ASC LIMIT 1

Here lies the problem

I have no idea on how to combine these two statments so that

1. shows the Manufacturer name not ID
2. Echos other details such as image price etc.

In a nutshell what i am trying to finish up with is showing 1 "Car of the Week" with image of car, Model of Car, Price of Car and Manufacturer Name.

At the moment i get all of the above except Manufacturer Name shows as ID.

I have attached my page to show what i have got using just the sql statetment

ELECT *
FROM vehicle
WHERE vehicle.VehicleCotw = 1
ORDER BY vehicle.VehicletUpdateDate ASC LIMIT 1


Any help here will be very appreciated.

Kind regards

Jonathon

Attached Files
cotw.zip
Sign in to reply to this post

Jason ByrnesWebAssist

Use the select clause from the first recordset:
SELECT Vehicle.*, manufacturer.VehicleManufacturerName
FROM Vehicle INNER JOIN manufacturer ON Vehicle.VehicleManufacturerID = manufacturer.VehicleManufacturerID


and the where clause from the second recordset:
WHERE vehicle.VehicleCotw = 1
ORDER BY vehicle.VehicletUpdateDate ASC LIMIT 1


so the entire recordset is:
SELECT Vehicle.*, manufacturer.VehicleManufacturerName
FROM Vehicle INNER JOIN manufacturer ON Vehicle.VehicleManufacturerID = manufacturer.VehicleManufacturerID
WHERE vehicle.VehicleCotw = 1
ORDER BY vehicle.VehicletUpdateDate ASC LIMIT 1

Sign in to reply to this post

Jon CunninghamBeta Tester

Solved

Can i just say that without your help Jason I would be going to the funny farm!!

Many thanks again.

Jonathon

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...