Unix Technical Forum

Using application data in query

This is a discussion on Using application data in query within the DB2 forums, part of the Database Server Software category; --> There's nothing special in this query: SELECT tbla.* FROM tbla, tblx WHERE tbla.cola = tblx.cola ORDER BY tblx.colz except ...


Go Back   Unix Technical Forum > Database Server Software > DB2

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 09:19 AM
regul8or
 
Posts: n/a
Default Using application data in query

There's nothing special in this query:

SELECT tbla.* FROM tbla, tblx WHERE tbla.cola = tblx.cola ORDER BY
tblx.colz

except that I'm creating tblx in application. It's a small array with
just 2 columns and usually 2-3 rows. Used for user preferences.

Do you think there's a way to do it? I'm using PHP and DB2 if it
matters.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 09:19 AM
Knut Stolze
 
Posts: n/a
Default Re: Using application data in query

regul8or wrote:

> There's nothing special in this query:
>
> SELECT tbla.* FROM tbla, tblx WHERE tbla.cola = tblx.cola ORDER BY
> tblx.colz
>
> except that I'm creating tblx in application. It's a small array with
> just 2 columns and usually 2-3 rows. Used for user preferences.



SELECT tbla.*
FROM tbla,
TABLE ( VALUES ( ... <generate rows here> ... ) ) AS tblx(cola, colb)
WHERE tbla.cola = tblx.cola
ORDER BY tblx.colb

An example for the generated rows could be:

VALUES (1, 2), (3, 4), (5, 6)

> Do you think there's a way to do it? I'm using PHP and DB2 if it
> matters.


Does not matter.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-27-2008, 09:19 AM
regul8or
 
Posts: n/a
Default Re: Using application data in query


Thanks! It did the trick

Just for the reference (to myself): It's in SQL Reference vol.1,
Fullselect, values-clause

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:28 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com