List:General Discussion« Previous MessageNext Message »
From:Philip M. Gollucci Date:May 12 2008 6:40pm
Subject:Re: Selecting my data first
View as plain text  
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jake Conk wrote:
| Hello,
|
| I have a table with 2 columns, file_id and owner_id. I want to select
| all the files and order by file_id but I want the ones that belong to
| me to show up first then everyone elses. Is this possible and how?
|
| This is what I'm trying to accomplish:
|
| SELECT * FROM whiles WHERE owner_id=<my_id> first THEN SELECT * FROM
| files ORDER by file_id

select * from files where owner_id = you
union
(select * from files where owner_id != you order by file_id)


- --
- ------------------------------------------------------------------------
Philip M. Gollucci (philip@stripped)
o:703.549.2050x206
Senior System Admin - Riderway, Inc.
http://riderway.com / http://ridecharge.com
1024D/DB9B8C1C B90B FBC3 A3A1 C71A 8E70  3F8C 75B8 8FFB DB9B 8C1C

Work like you don't need the money,
love like you'll never get hurt,
and dance like nobody's watching.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.8 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIKI81dbiP+9ubjBwRAuOiAJ9e4kGv1qIUs7CbF5LGv30CaQfZgACdHXFM
FKFSw66nKpVqcJDug776TBI=
=YQxy
-----END PGP SIGNATURE-----
Thread
Selecting my data firstJake Conk12 May
  • Re: Selecting my data firstPhilip M. Gollucci12 May
  • Re: Selecting my data firstJason Pruim12 May
  • Re: Selecting my data firstOmni Adams12 May
  • Re: Selecting my data firstAndy Wallace12 May