Query to get certain records twice

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello
I need a query that results all records that contain for exsample LS in
field1 twice.
Even if this LS is in table only once.
Like this:
LS 123
LS 123
HS345
SH532

Is ithis possible?
Thanks inadvance.
Laura
 
You could do it with a union query. Here's an example using the Customers
table from Northwind ...

SELECT dbo_Customers.CustomerID
FROM dbo_Customers
UNION ALL SELECT dbo_Customers.CustomerID
FROM dbo_Customers
WHERE dbo_Customers.CustomerID LIKE 'AL*'
ORDER BY dbo_Customers.CustomerID

Don't forget to use the 'ALL' keyword, as the default behaviour of a union
query is to not include duplicate rows.
 
Thank you Brendan
It worked.
Laura

Brendan Reynolds said:
You could do it with a union query. Here's an example using the Customers
table from Northwind ...

SELECT dbo_Customers.CustomerID
FROM dbo_Customers
UNION ALL SELECT dbo_Customers.CustomerID
FROM dbo_Customers
WHERE dbo_Customers.CustomerID LIKE 'AL*'
ORDER BY dbo_Customers.CustomerID

Don't forget to use the 'ALL' keyword, as the default behaviour of a union
query is to not include duplicate rows.
 
Back
Top