Skip to content Skip to sidebar Skip to footer

How To Format Sqlite Select Output?

I have a simple SQLite DB. One table with a key and name and a description columns. I want to be able to format the data so I can use it in a html select pulldown. Here's one of th

Solution 1:

Well, your language should catch that query result and format it as you want. When you write software cleanly (MVC approach), you don't mix data and formatting. It's not just for the possibility of non-web deployment one day, it's primarily to organize your work in specialized logical structures: one for data, one for control, one for viewing.

But here's the way to do it with literals. You were close, you just needed concatenation:

SELECT '<option value=''' || ppt_branch_id || '''>' || ppt_branch_name || '</option>' 
FROM ppt_branch;

Post a Comment for "How To Format Sqlite Select Output?"