Note that there are some explanatory texts on larger screens.

plurals
  1. POCombine 3 SQL SELECT's into 1
    text
    copied!<p><strong>* UPDATE *</strong></p> <p>Sorry! I was in a bit busy and in a hurry, so didnt clear this up properly.</p> <p>Essentially the 3 queuries all relate to a users details. I am updating a site for a new client, where i am restricted by the current database structure. As such my aim is to try and get all this info in one db calll rather than 3 seperate ones, as this would appear to be the most efficient way of the two.</p> <p>I was hoping someone smarter than me might know of some ninja moves that could retrieve this in one go. I really should have spent more time trying this myself before posting.</p> <p>Thanks for your time.</p> <hr> <p>The common value is @dealerId - which is an int value.</p> <p>Thanks</p> <pre><code> SELECT TOP(100) PERCENT dbo.ReferenceItems.Title FROM dbo.AdvertiserLanguageLink INNER JOIN dbo.ReferenceItems ON dbo.AdvertiserLanguageLink.LanguageId = dbo.ReferenceItems.Id WHERE (dbo.AdvertiserLanguageLink.AdvertiserId = @dealerId) ORDER BY dbo.ReferenceItems.Title SELECT TOP (100) PERCENT dbo.AircraftTypes.AircraftTypeDescription, dbo.AircraftTypes.AircraftTypeId FROM dbo.AdvertiserAircraftTypeLink INNER JOIN dbo.AircraftTypes ON dbo.AdvertiserAircraftTypeLink.AircraftTypeId = dbo.AircraftTypes.AircraftTypeId WHERE (dbo.AdvertiserAircraftTypeLink.AdvertiserId = @dealerId) ORDER BY dbo.AircraftTypes.SortSequence SELECT TOP (1) dbo.Addresses.Country, dbo.Addresses.Telephone1 FROM dbo.AdvertiserAddressLink INNER JOIN dbo.Addresses ON dbo.AdvertiserAddressLink.AddressId = dbo.Addresses.Id WHERE (dbo.AdvertiserAddressLink.AdvertiserId = @dealerId) AND (dbo.Addresses.AddressType = 1 OR dbo.Addresses.AddressType = 0) ORDER BY dbo.Addresses.Sequence </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload