more sql silliness

View: New views
6 Messages — Rating Filter:   Alert me  

more sql silliness

by Erik Lewis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Been playing with this for awhile

SELECT CONCAT('http://images.amazon.com/images/P/'isbn'.01.TZZZZZZZ.jpg') FROM isbn_experiment LIMIT 10;

Seems straightforward prepend and append the amazon url's for cover art to an isbn.  Yet I only get the first part not isbn nor the end.  Done several permutations but I ain't getting anywhere.



_______________________________________________
Koha mailing list
Koha@...
http://lists.katipo.co.nz/mailman/listinfo/koha

Re: more sql silliness

by Greg Barniskis-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Erik Lewis wrote:
> Been playing with this for awhile
>
> SELECT
> CONCAT('http://images.amazon.com/images/P/'isbn'.01.TZZZZZZZ.jpg') FROM
> isbn_experiment LIMIT 10;
>
> Seems straightforward prepend and append the amazon url's for cover art
> to an isbn.  Yet I only get the first part not isbn nor the end.  Done
> several permutations but I ain't getting anywhere.

You need some commas I think.

CONCAT('string one','string two','string three')


--
Greg Barniskis, Computer Systems Integrator
South Central Library System (SCLS)
Library Interchange Network (LINK)
<gregb at scls.lib.wi.us>, (608) 266-6348
_______________________________________________
Koha mailing list
Koha@...
http://lists.katipo.co.nz/mailman/listinfo/koha

Re: more sql silliness

by Magnus Enger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



2009/11/5 Erik Lewis <elewis@...>
Been playing with this for awhile

SELECT CONCAT('http://images.amazon.com/images/P/'isbn'.01.TZZZZZZZ.jpg') FROM isbn_experiment LIMIT 10;

I think you may need som commas in the parentheses:

SELECT CONCAT('http://images.amazon.com/images/P/', isbn, '.01.TZZZZZZZ.jpg') FROM isbn_experiment LIMIT 10;

http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_concat ;-)

Regards,
Magnus Enger
libriotech.no

_______________________________________________
Koha mailing list
Koha@...
http://lists.katipo.co.nz/mailman/listinfo/koha

Re: more sql silliness

by Erik Lewis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Actually tried it with the commas, same effect. 


On Nov 5, 2009, at 2:57 PM, Magnus Enger wrote:



2009/11/5 Erik Lewis <elewis@...>
Been playing with this for awhile

SELECT CONCAT('http://images.amazon.com/images/P/'isbn'.01.TZZZZZZZ.jpg') FROM isbn_experiment LIMIT 10;

I think you may need som commas in the parentheses:

SELECT CONCAT('http://images.amazon.com/images/P/', isbn, '.01.TZZZZZZZ.jpg') FROM isbn_experiment LIMIT 10;

http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_concat ;-)

Regards,
Magnus Enger
libriotech.no


_______________________________________________
Koha mailing list
Koha@...
http://lists.katipo.co.nz/mailman/listinfo/koha

Re: more sql silliness

by Greg Barniskis-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Erik Lewis wrote:
> Actually tried it with the commas, same effect.

I'd think isbn was a string, but if it's numeric you might need to

'string one', CAST(isbn AS CHAR), 'string three'


--
Greg Barniskis, Computer Systems Integrator
South Central Library System (SCLS)
Library Interchange Network (LINK)
<gregb at scls.lib.wi.us>, (608) 266-6348
_______________________________________________
Koha mailing list
Koha@...
http://lists.katipo.co.nz/mailman/listinfo/koha

Re: more sql silliness

by Erik Lewis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

It's VARCHAR, unfortunately that didn't work, but thanks for clueing  
me into what I see as a very useful function.

On Nov 5, 2009, at 3:06 PM, Greg Barniskis wrote:

> Erik Lewis wrote:
>> Actually tried it with the commas, same effect.
>
> I'd think isbn was a string, but if it's numeric you might need to
>
> 'string one', CAST(isbn AS CHAR), 'string three'
>
>
> --
> Greg Barniskis, Computer Systems Integrator
> South Central Library System (SCLS)
> Library Interchange Network (LINK)
> <gregb at scls.lib.wi.us>, (608) 266-6348

_______________________________________________
Koha mailing list
Koha@...
http://lists.katipo.co.nz/mailman/listinfo/koha