A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
this week in the
Joined: Jun 22, 2005
Apr 09, 2012 07:24:08
select 1 from someTable
do? What is its use ?
Keep Smiling Always — My life is smoother when running silent. -paul
The Linux Documentation Project
Joined: Aug 22, 2010
Apr 10, 2012 17:19:04
This query creates a cursor which contains one column and as many rows as there are in the table. Value of that column is
in all rows.
This is not very useful construct.
I sometimes do use constants in the select clause in more complicated circumstances, eg:
select 'Your table' title, 1 the_order, some_other_value from table1 union all select 'His table', 2, some_other_value from table2 order by 2, 3;
order by 2, 3
causes ordering by second and third column of the resultset. It is useful with
operator as there could be ambiguity in column names otherwise.)
I agree. Here's the link:
subject: Select 1
Strange JDBC PreparedStatements Problem
issue to pass the dynamic value in query
html text box issues
SQL Current Time
MySQL equivalent to Oracle's "select * from dual;"
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014