Solved

My SQL Query, append text to a result and add new default results??

Posted on 2009-06-27
7
394 Views
Last Modified: 2012-05-07
Hi,
I have this query( in code box):

The line:
xcart_products.productid AS link
I actually need to add 'http://www.mydomain.com/product.php?id=' before to returned number.

I also need to add an extra colum with todays date automatically added??

I would normally add these on the page but this is being exported directly form Navicat to an CSV file.

Help!!!!!!!!!
Tony


SELECT
xcart_products.productcode AS id,
xcart_products.product AS title,
xcart_products.list_price*1.15 AS price,
xcart_products.descr AS description,
xcart_products.avail AS quantity,
xcart_products.forsale,
xcart_products.weight AS weight,
xcart_categories.category AS product_type,
xcart_manufacturers.manufacturer AS brand,
xcart_quick_flags.image_path_T AS image_link,
xcart_products.productid AS link
FROM
xcart_products
Inner Join xcart_products_categories ON xcart_products_categories.productid = xcart_products.productid
Inner Join xcart_categories ON xcart_categories.categoryid = xcart_products_categories.categoryid
Inner Join xcart_manufacturers ON xcart_manufacturers.manufacturerid = xcart_products.manufacturerid
Inner Join xcart_quick_flags ON xcart_quick_flags.productid = xcart_products.productid

Open in new window

0
Comment
Question by:tonypearce
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 21

Expert Comment

by:theGhost_k8
ID: 24727111
you can surely use concat function:

select concat( 'http://www.mydomain.com/product.php?id=' ,FIELDNAME) as aliasfieldname .....
0
 

Author Comment

by:tonypearce
ID: 24727191
that works great, thanks, any idea how to add a new column result with a default value??
Tony
0
 
LVL 21

Expert Comment

by:theGhost_k8
ID: 24727222
couldn't get the question:
Do u mean adding  to table?
ALTER TABLE tablename MODIFY colNAME <DATATYPE> DEFAULT <VALUE>;
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:tonypearce
ID: 24727232
Sorry, I'm not being clear...

I am producing a froogle feed from Navicat, unfortunatly the database does not have all the fields required, so when running the query I need to output extra results set to a default value...
0
 
LVL 21

Accepted Solution

by:
theGhost_k8 earned 500 total points
ID: 24727236
well you can directly select required values...

select "string value" as columnname .....
0
 

Author Comment

by:tonypearce
ID: 24727243
Thats it,

Thanks so much.......
0
 

Author Closing Comment

by:tonypearce
ID: 31597268
Thanks so much.....
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
This post contains step-by-step instructions for setting up alerting in Percona Monitoring and Management (PMM) using Grafana.
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question