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 dencom 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. HestonJames

    Entities which have relationship through one table but not another.

    Hello All, I'm looking for some help building a query which has currently got my head spinning right around. I have several entities, these look something like this: SaleOrder -------- SaleOrder_ID SaleOrderItem ----------- SaleOrderItem_ID SaleOrder_ID Manufacturer_ID Manufacturer...
  2. HestonJames

    Auto-Suggest Query

    Hello Guys, I'm looking for some help on writing a query which is going to be used for populating an auto-suggest field for a list of customers. The customer table which I'm querying has three fields which comprise the customers name. Salutation FirstName LastName The form the user fills in...
  3. HestonJames

    Query from beginning of this calendar week

    Hello Guys, I have a query which looks something like this: Select COUNT(SaleOrder_ID) AS ThisWeekByMemberCount From SaleOrder Where Placed IS NOT NULL And Placed after start of current calendar week Can someone help me complete the puzzle? I'm used to using DateAdd and could quite...
  4. HestonJames

    Count Join with Where

    Hello Guys, I'm looking for some help on this query: Select Account_Type.Name, Count(Account.Account_ID) As Accounts From Account_Type Left Outer Join Account On Account_Type.Account_Type_ID = Account.Account_Type_ID Group By Account_Type.Name This runs just fine and produces a fair...
  5. HestonJames

    Last day of the month type question

    Hello Guys, I have a scheduled script that runs every day and I want to pull a list of customers who should be billed on this day of the month. Now, I've mocked up a little data to show you how I want this to work. DECLARE @Customers TABLE ( Customer_ID int IDENTITY(1,1) NOT NULL...
  6. HestonJames

    Query To Delete Statistics

    Hello Guys, I've been having this problem: http://www.tek-tips.com/viewthread.cfm?qid=1555259&page=1 Seems that DTA has crashed at some point and left lots (295) statistics on my database and it's causing problems :-) I need a query which will delete all statistics from a table which are...
  7. HestonJames

    Update Statistics Takes AGES

    Hello Guys, Just wanted to run this past you as I have what I think to be odd behaviour on one of my maintenance tasks. The task does all the usual things created by the maintenance plan wizard on a handfull of databases, such as check integrity, rebuild indexes, reorganize indexes, shrink...
  8. HestonJames

    Disk Management Help

    Good Morning Guys, I'm looking for some advice on how best to manage my disks and partitions on the server. It's only a small box, at the moment we just have a single physical disk with a single partition which contains everything, windows, applications, sql server and all the databases. My...
  9. HestonJames

    Index Advice

    Hello Guys, I thought I'd ask your advice on this one, quite commonly within my applications I'll have a query which has optional WHERE clauses in it, so sometimes the query is executed looking like this: Select Username From Users Where FirstName = 'Dave' This is not the real query, I'm...
  10. HestonJames

    enforce ssl/https

    Hello Chaps, I've got a site configured in IIS6 which I need to ensure is only accessible as https so that nobody is simply finding the paths of resources within the site and then hitting them over standard http. I've played in the past with using server side code to check the url and pass the...
  11. HestonJames

    Is this the best way to schedule a task?

    Hello Guys, I'm relatively inexperienced when it comes to MySQL, this morning I've been working on a maintenance script for the database which optimizes tables within, deletes a bunch of old data and does a bunch of other small tasks. I've saved this into a .SQL script, which I'm now planning...
  12. HestonJames

    Select random element from list.

    Hello Guys, I've got a query which looks something like: Insert Into MyTable ( Something, Another, OneMore ) Values ( 100, Name, 300 ) Now what I want to do is insert a random...
  13. HestonJames

    Little performance tuning on this query.

    Morning Chaps, As ever I'm after a little advice on the optimal way to achieve a task. I have the following query at the moment: SELECT thinktank.thinktank_ID , ThinkTank.Name , ThinkTank.Installed , RemoteAddress.Address , RemoteAddress.DateTime FROM ThinkTank INNER...
  14. HestonJames

    Select/Insert Same Table With Modified DateTime

    Hello Guys, I have a tables which looks somewhat like this: CustomerTransaction ---------------------- CustomerTransaction_ID - Int - PK - Identity Customer_ID - Int Description - Varchar TransactionDateTime - DateTime What I want to do is given a datetime range and a customer_id INSERT...
  15. HestonJames

    Date Barriers

    Hello Chaps, I've got a requirement here whereby we charge customers for registering with our service however on certain dates we place in a new price increase, customers that have registered before this date will still be charged the old price however any new registrations will be charged the...
  16. HestonJames

    Most frequent instance of string.

    Hello Guys, I've got the following example dataset for you to play with, basicly its a set of very basic weather data, you'll see at the moment that it calculates the average temperature for the records which are pulled out. Declare @WeatherReport Table ( Location_ID int, Description...
  17. HestonJames

    Help with a count.

    Hello Chaps, I have the following query: Select Campaign.Campaign_ID, Campaign.Name, Event.ID, Media.Name As MessageName, Media.Type From Campaign Left Join Event On Campaign.Campaign_ID = Event.Campaign_ID Left Join Media On Event.Media_ID = Media.Media_ID Where Campaign.Owner_ID =...
  18. HestonJames

    I feel so ashamed.

    This has to be the simplest query I've not been able to get working, I hang my head on this and hope you wont judge me ;-) I have this query: Delete From ThinkTankGroup Where ThinkTankGroup_ID Not In ( Select ThinkTankGroup_ID From ThinkTank ) Now, this is meant...
  19. HestonJames

    Query to create tag cloud

    Hello Guys, Looking for a little help forming this query as the concept is currently confusing me. The end goal is to pull data which I can use to create a 'tag' or 'keyword' cloud. I have three tables which look like this: Media ------ Media_ID Media_Lnk_MediaTag ------------------...
  20. HestonJames

    Maintenance plan backup

    Morning guys, I used a maintenance plan to setup a bunch of tasks for shrinking and backing up the database on a nightly basis about 2 weeks ago. At the moment all the backup files sit in directory on the disk, however, I really only need the last couple of days of full backups. Is it possible...

Part and Inventory Search

Back
Top