Concat URL & PageID

I need to join/concat the p_URL & pid colums, without loosing the other colums.

Here is the start with all the colums

SELECT pid, p_parent_id, p_primary, p_page_order, p_name, p_desc, p_title, p_content, p_url, p_target, p_meta_words, p_meta_desc, p_show
FROM titzerfuneral.pages
WHERE p_show = MMColParam [is equal to 1]
ORDER BY p_page_order ASC

And here is what I have come up with:

SELECT *, (p_url&'?pid='pid) AS p_url
FROM titzerfuneral.pages
WHERE p_show = MMColParam
ORDER BY p_page_order ASC
dstubblefieldAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Saqib KhanSenior DeveloperCommented:

SELECT joined=p_url+pid,p_parent_id, p_primary, p_page_order, p_name, p_desc, p_title, p_content, p_target, p_meta_words, p_meta_desc, p_show
FROM titzerfuneral.pages
WHERE p_show = MMColParam [is equal to 1]
ORDER BY p_page_order ASC

if does not work then what is your database engine?
dstubblefieldAuthor Commented:
Database Engine is MsSQL the p_url is default.asp, staff.asp etc. then the pid is the unique key colum together they need to be be like this, default.asp?pid=1 or staff.asp?pid=2, (p_url&'?pid='pid)
Saqib KhanSenior DeveloperCommented:


SELECT myUrl = p_url+'?pid='+pid,p_parent_id, p_primary, p_page_order, p_name, p_desc, p_title, p_content, p_target, p_meta_words, p_meta_desc, p_show
FROM titzerfuneral.pages
WHERE p_show = MMColParam [is equal to 1]
ORDER BY p_page_order ASC


so in your Code "myUrl" (Virtual Column) will hold your URL Concat.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dstubblefieldAuthor Commented:
I get this error "Syntax error converting the varchar value to Default.asp?pid' to a column of data type int"

the 'p_url' is a 'varchar' and the 'pid' is the 'int' key column,

dstubblefieldAuthor Commented:
You just won the points for moving me in the right direction, the answer is:

SELECT myURL = p_url+'?pid='+CAST(pid AS VARCHAR), pid, p_parent_id, p_primary, p_page_order, p_name, p_desc, p_title
FROM titzerfuneral.pages

Just needed to add the CAST(pid AS VARCHAR) to convert the 'int' to a 'varchar'
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Dreamweaver

From novice to tech pro — start learning today.