Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

SQL statement

  • 02-10-2006 11:03am
    #1
    Closed Accounts Posts: 289 ✭✭


    Hi what do i need to add to this stmt to delete the result ?

    select ct_cust1_text01,ct_address,ct_cust1_text09,count(*)from TABLE_NAME group by ct_cust1_text01,ct_address,ct_cust1_text09 having count(*) > 1


    i have tried delete * from TABLE_NAME where (select...)

    not great at SQL appreciate any help...


Comments

  • Registered Users, Registered Users 2 Posts: 44,201 ✭✭✭✭Basq


    Try:
    DELETE from TABLE_NAME where (select...)

    No wildcard necessary!


  • Registered Users, Registered Users 2 Posts: 4,188 ✭✭✭pH


    DELETE FROM .... with a GROUP BY and HAVING clause?

    try something like :

    DELETE FROM table_name where CUST_ID IN (
    .. Your select statement rewritten to select just cust_ids that match the criteria
    )


  • Registered Users, Registered Users 2 Posts: 1,466 ✭✭✭Smoggy


    as Ph says , just use the primary key of your table in the select and then use in keyword IN as part of the delete.


Advertisement