Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. swampBoogie

    change "count(*)" into "exists"

    select A.c1, A.c2, A.c3, case when exists (select 1 from B where B.id = A.idFromB and B.c1 = somevalue and B.c2 = somevalue) then 1 else 0 end as...
  2. swampBoogie

    Unique records using replace -> group by not working

    Standard sql only allows for column references in a group by clause. You can neither use expressions nor correlation names.
  3. swampBoogie

    How to add results of 2 $amt Oracle subquery fields

    You can not use a column correlation name in other expressions, except in the order by clause. The general technique is select a + b from (select <expression> as a, <expression> as b, ... from ...) dt
  4. swampBoogie

    SQL-92 documentation

    Isnull is not standard SQL. Coalesce is.
  5. swampBoogie

    Comparing URLS with SQL

    It's called overlay in standard SQL. It has the bloated syntax OVERLAY(<expression> PLACING <expression> FROM <numeric value expression> [FOR <numeric value expression>]) I haven't seen any DBMS with support for this.
  6. swampBoogie

    Returning &quot;Distinct&quot; results from multiple tables

    select customer_no from store_a_customer_tran where tran_type_cd = 'Z' union select customer_no from store_b_customer_tran where tran_type_cd = 'Y'
  7. swampBoogie

    SQL to return if a single row(can be&gt;1) and certain criteria

    select id from t group by id having sum(case when keyword = 'ISV' then 0 else 1 end) = 0
  8. swampBoogie

    Is &quot;SELECT *, Date&quot; possible?

    Standard SQL does not (currently) allow select *,expressions ... from t ... use select t.*,expressions ... from t ...
  9. swampBoogie

    Is my INSERT statement good ANSI_SQL

    Use of ` is not ANSI SQL compliant. @lastID:=LAST_INSERT_ID() is not ANSI SQL compliant. @ is not a valid character in an identifier. LAST_INSERT_ID is a Mysql specific routine. ; is only used as delimiter between statements, not as a terminator.
  10. swampBoogie

    DISTINCT statement help

    If you have the data dateColumn | rateColumn ------------------ 2006-04-23 | 1234 2006-04-23 | 5678 what result do you want? It is not clear from your post.
  11. swampBoogie

    Simple query?

    select column2, count(*) from t group by column2
  12. swampBoogie

    Problems with SQL table creation

    You must specify the maximum length for the varchar columns.
  13. swampBoogie

    SELECT SUM(pointsrecvd) FROM (SELECT DISTINCT)...

    SELECT SUM(pointsrecvd),userid FROM tblPointSystem group by userid order by 1 desc 1 reflects the position in the select list of the item you wish to order by.
  14. swampBoogie

    SELECT SUM(pointsrecvd) FROM (SELECT DISTINCT)...

    SELECT SUM(pointsrecvd),userid FROM tblPointSystem group by userid
  15. swampBoogie

    Join to find rows not in second table

    SELECT group_id FROM group g left join usergroup ug on ug.group_id = g.group_id and ug.user_id = 3 where ug.group_id is null
  16. swampBoogie

    Select rows problem

    SELECT tbl1.id, name, t2.color FROM tbl1 left join tbl2 t2 on tbl1.id = t2.t1_id left join tbl2 t3 on t2.t1_id = t3.t1_id and t3.color = 'green' where t3.color is null time to upgrade ...
  17. swampBoogie

    Select rows problem

    SELECT tbl1.id, name, color FROM tbl1 left join tbl2 on tbl1.id = tbl2.t1_id where not exists (select * from tbl2 where tbl1.id = tbl2.id and color = 'green')
  18. swampBoogie

    search just a few caracters

    select * from venda where cast(integerColumn as varchar(20)) like '%'+xxxxx+'%'
  19. swampBoogie

    Applying HAVING (or equivalent) to subquery results

    The where clause is not in the wrong place. I typed the conditions incorrectly but it is located where I intended it to be. Note the use of a derived table.
  20. swampBoogie

    Nested query?

    select LastName, FirstName, case when min(credentials.fk) is null then 'No' else 'Yes' end as credentaials from demographics left join credentials on demographics.pk = credentials.fk group by lastName,FirstName

Part and Inventory Search

Back
Top