Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
MaxD
Starting Member
2 Posts |
Posted - 2007-06-15 : 08:27:34
|
| Hi. Not sure which section this request needs to be put in, but i'm relatively new to SQL.I have 1 table which contains an user_id (autonumber), user_name, and user_profile.I have 2 other tables:config_version (cv) and config (c)These two tables both access the user table (us) to view the user_id (which is required).I want to be able to view the user_names for both "cv" and "c" on a seperate page. Using the code below, i'm lost. I created what i wanted in MS Access with the use of a 2nd table (this might be easier to understand than my rant above). However, I don't want a 2nd table.Can someone provide me with a function, or the "answer" to my problem?Highlighted Blue - just there to fill in the front page with data (not wanted)Highlighted Green - doesn't work, but was my first attemptCode:public function ShowQuotes Dim objConn Dim objADORS Dim strSQL Dim row Set objConn = Server.CreateObject("ADODB.Connection") objConn.ConnectionString = strConn objConn.Open Set objADORS = CreateObject("ADODB.RecordSet") strSQL = "Select top 50 " strSQL = strSQL & " cv.config_version_id as cvid, cv.configuration_id as cid, cv.version_number as cnum" strSQL = strSQL & ", cv.status as cstat, cv.total_price as cprice, cv.modification_date as cmod, cv.version_description as cvrem" strSQL = strSQL & ", c.remarks as qrem" strSQL = strSQL & ", p.prod_description as pdesc, p.version as pvers, p.status as pstat" strSQL = strSQL & ", cust.customer_name as custname" strSQL = strSQL & ", us.user_nt_login as modname" strSQL = strSQL & ", us.user_name as usname" ' strSQL = strSQL & ", cv.user_id as modname" strSQL = strSQL & " from tbl_config_version as cv, tbl_configuration as c, tbl_product as p, tbl_user as us, tbl_customer as cust" strSQL = strSQL & strWhere 'SETS RESULTS TO BE UNIQUE strSQL = strSQL & " and us.user_id = c.user_id" strSQL = strSQL & " and cv.configuration_id = c.configuration_id" strSQL = strSQL & " and c.product_id = p.product_id" strSQL = strSQL & " and c.customer_id = cust.customer_id" strSQL = strSQL & strOrderBy & ";"Image: www.mcdcs.co.uk/TT.jpg |
|
|
MaxD
Starting Member
2 Posts |
Posted - 2007-06-15 : 08:32:55
|
| I should've mentioned, this code is held within an ASP page and utilises VBScript and SQL to display the info.I only used MS Access as an example. |
 |
|
|
|
|
|
|
|