Abu Aisyah Official Web Site

Tag: query

Fast Tutorial About YQL Select Query

by Abu Aisyah on Jan.26, 2010, under Catatanku, Ngoprek, PHP

YQL or Yahoo Query Language, a new API from yahoo that makes it easier to extract data from an existing HTML information on the Internet. You can INSERT, UPDATE, DELETE, SELECT from an HTML page dynamically data recorded in the HTML page. I made this short tutorial is only for Open Data, for example you want to create RSS from a specific web page for example. As an example we take from a site in Indonesia’s largest infotainment. For example we want to find out the latest news there, either movie reviews or celebrity news, we can create a simple RSS. Well the following steps: (continue reading…)

Leave a Comment :, , , more...

Another Freak Query

by Abu Aisyah on Oct.23, 2009, under Catatanku, Ngoprek

Yes true, I’m facing a crazy query once again. Actually, I could have done with a PHP script, but it did not really help me if I need dynamic data in the database. While I knew I could not work 100% in PHP scripts.

For example, you have an uncertain data, such as the data is mine:

“TRUE POINT … +125 blåa blåa blaaa … … PIN = 34,234″

For the record, I just need a “TRUE POINT +125″, with the assumption that the number 125 is dynamic, such as 100, 10, 12,314, 7,723,423, and so on.

I wonder what’s on your mind to show the “TRUE POINT + number”?? Regex. Yup, that’s right. But from my search results in the manual, I only get that regexp function will only generate the value 0 or 1. I can not take a string value.

So I was really dizzy for 15 minutes :) to look for. And finally I found a way, though I think I know there are other ways. But please know my friend, this is what I can and I find.

SELECT CONCAT(‘TRUE POINT ‘,left( substr( pharse, instr(pharse, ‘+’ ) ) , instr( substr( pharse, instr( pahrse, ‘+’ ) ) , ‘ ‘ ) ) )
FROM tabel_string
;

What the hell ? Yeah, I khow. You maybe feel dizzy to read it. :P
I’ll explain:
The logic is, I’m looking for a sign ‘+’ used in the column. I use the substr, because by using that function I can go straight to the place where char ‘+’ is, of course, guided by InStr to find integernya value. Then, surely I will get the sentence “+ number Blah … blah … blåa …”.

Once out of here I can know that there is a gap between the numbers and says thereafter. Quite right, space. That way I’ll be able to remove the value of the space, by looking for numbers in which the first space in the Instr. After that stay I love the functions left to cut it to only display + number only. : D

Then I just add concat function. Et voila, success. CMIIW.

4 Comments :, more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!