?
Solved

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

Posted on 2009-06-27
7
Medium Priority
?
395 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:K V
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:K V
ID: 24727222
couldn't get the question:
Do u mean adding  to table?
ALTER TABLE tablename MODIFY colNAME <DATATYPE> DEFAULT <VALUE>;
0
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 

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:
K V earned 2000 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

777 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