Solved

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

Posted on 2009-06-27
7
393 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Finding Where Clause Value in SQL Views and SP 21 61
Delete image(s) associated with record(s) 16 46
Merge join vs exist 3 37
SQL Server how to create a DYNAMIC TABLE? 11 51
If you find yourself in this situation “I have used SELECT DISTINCT but I’m getting duplicates” then I'm sorry to say you are using the wrong SQL technique as it only does one thing which is: produces whole rows that are unique. If the results you a…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

734 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