|
|
 |
Re: FN-FORUM: MySQL
date posted 14th November 2007 12:57
Depends on a few things, as to the most efficient way though.
Also, are you using MySQL 5? If so, you can use sub-selects, inline
views etc. Prior to 5, you are a bit limited.
How did you obtain the list of IDs you want to return? Was it via some
other SQL query? If so, then try why not simply extend that query and
filter that way. That is also more dynamic, as you can then drive the
list from the database itself.
If it is all db driven, then there are a few ways......
o IN (list of IDs) (as suggested by a few so far)
o EXISTS
o inline view
o sub-select
o UNION
Let me know a bit more and I can let you know the most appropriate way.
What sort of volumes are you talking about too?
Lists - ARKAD Solutions wrote:
> Morning all,
>
> Blonde day at the moment and I can't think of how to do this....
>
> How do I do select statement to get a specified number of records from a
> table.
>
> What I have so far is...
>
> SELECT PictureTypeID, PictureTypeDescription FROM PictureType
>
> I have a list of PictureTypeID Values...which is what I want to select..
>
> TIA
>
> Darren
>
>
>
--
Dominic Raywood
Rubicon Computer Services Limited
W: http://rubiconcsl.com
E: [EMAIL REMOVED]
T: 08456 521 561 (+44 1823 698420)
F: 08456 521 561
M: 07050 204998 (+44 7811 252573)
Skype: RubiconCSL
|
 |
|